-
Notifications
You must be signed in to change notification settings - Fork 17
/
CheatSheet.txt
204 lines (151 loc) · 8.3 KB
/
CheatSheet.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
Author: Douglas Tucker
Reviewer: Greg Madejski
Created: 2018-11-02
Updated: 2018-12-21
Updated: 2019-02-08
-----------------------------------------------------------
Getting Started:
This link will get you set up with the NCSA access:
https://github.com/LSSTScienceCollaborations/StackClub/blob/master/GettingStarted/GettingStarted.md
First-time access to NCSA VPN via Cisco anyconnect if you already have Cisco anyconnect for another VP (e.g., FermilabVPN):
You can copy additional VPN profiles into the xml file in /opt/cisco/anyconnect/profile/ (Mac OS).
See also:
https://superuser.com/questions/932650/cisco-anyconnect-secure-mobility-client-multiple-profiles
-----------------------------------------------------------
Connecting in to the LSST site at NCSA...
Start CiscoAnyconnect Client for NCSA VPN. Use NCSA kerberos principal and password for the
NCSA VPN username and password, and the 6-digit number provided by DUO for the second password.
JupyterLab:
Point broswer to http://lsst-lsp-stable.ncsa.illinois.edu/nb
Release version, Medium --> Spawn
+Launcher --> terminal
This will open a terminal window within a spawned JupyterLab notebook in your browser.
Now that you are connected in, what to do? That is the topic of the next section...
-----------------------------------------------------------
Example workflow, from "git clone" to merge with remote repo...
See also:
https://github.com/LSSTScienceCollaborations/StackClub/blob/master/GettingStarted/HelloWorld.ipynb
Within the terminal that you opened up in the JupyterLab notebook from the previous section,
run the following command-line commands...
# Move to the "notebooks" directory:
cd notebooks
# The first time you do this, clone the StackClub repo:
git clone https://github.com/LSSTScienceCollaborations/StackClub.git # first time only!
# This will create a clone of the StackClub repo in the directory "StackClub".
# If, for some reason in the future, you want to "blow away" this clone of the repo
# and start afresh, you can either rename or delete the "StackClub" directory
# and then re-run the above "git clone" command.
# This XKCD panel is of relevance: https://imgs.xkcd.com/comics/git.png
# Move to the "StackClub" directory:
cd StackClub
# Test out some useful "git" commands:
git remote -v # check remote repo
git branch -a # list all branches
git status # very useful; e.g., after every "git" command!
# We want to keep the "Master branch" of StackClub clean and up-to-date with the StackClub repo,
# and develop in one's own "Development branch".
# Therefore, within the main "StackClub" directory, create a new branch and move to it:
git checkout -b project/helloworld/douglasleetucker # Create a new branch and move to it...
git branch # Confirm you are now working on that branch
# Alternatively, one can create a new branch with one command and move to it with a second command.
# Here is the same procedure as the previous step, but splitting the "git checkout -b" step into two
# parts:
git branch project/helloworld/douglasleetucker # Create a new branch
git checkout project/helloworld/douglasleetucker # Move to branch project/helloworld/douglasleetucker
git branch # Confirm you are now working on that branch
# Note: if you want to move to a branch you had created previously, just issue the
# git checkout command omitting the "-b" option; e.g., to move to a previously created branch
# "project/helloworld/douglasleetucker", just issue the following command:
git checkout project/helloworld/douglasleetucker
#
# * * * Make changes to the branch here. * * *
#
If editing a notebook:
1. make your changes.
2. check your changes work.
3. from menu bar: Kernel --> Restart and Run All Cells
a. fix any errors
b. re-do until errors are all corrected
4. from menu bar: Kernel --> Restart and Clear All Cells
5. hit "save" in the notebook editor to make sure edits are captured.
# Commit changes to local branch:
git status
git add <filename> # if there is a file ("<filename>") to add...
git commit <filename> -m "Add a fairly detailed comment on the changes you made here" # check in changes for a given file
# or
git commit -am "Add a fairly detailed comment on the changes you made here" # check in changes "en masse"
git status
# Push updates to origin on github:
git push origin project/helloworld/douglasleetucker
# Submit a "pull" request via the webpage
https://github.com/LSSTScienceCollaborations/StackClub/pulls
# and click on green "New pull request" button.
# This will alert others in the StackClub that your changes
# are ready for a Code Review. It is good to assign at
# least one possible reviewer explicitly and mention her/him
# explicitly by her/his GitHub name in the description of
# the "pull" request.
# There may be some iteration with the Code Reviewers.
# You will be able to follow the discussion via e-mail
# and also via the aforementioned "pull" request webpage:
https://github.com/LSSTScienceCollaborations/StackClub/pulls
# Once the Code Reviewers are satisfied, they will
# will approve the changes and you will get an e-mail
# indicating the "pull" request has been approved.
# After getting e-mail saying the "pull" request has been approved, perform a "merge".
#
# If the branch has no conflicts with the master branch on GitHub, you might be able to
# just click on the Big Green "Merge pull request" Button at the bottom of this particular
# "pull" request's webpage (e.g., for "pull" request #153, at the bottom of the webpage
# https://github.com/LSSTScienceCollaborations/StackClub/pull/153
#
# Otherwise, here is the step-by-step command-line version.
# (In either case, you might still want/need to do the
# "git branch -d project/helloworld/douglasleetucker"
# and
# "git push origin --delete project/helloworld/douglasleetucker"
# commands shown below.)
git checkout master # Switch from project/helloworld/douglasleetucker back to master branch (locally)
git pull origin master # Make sure local master branch is up-to-date with remote origin master branch on github
git branch --merged # Check to see if project/helloworld/douglasleetucker has been merged locally
git merge project/helloworld/douglasleetucker # Merge project/helloworld/douglasleetucker with local master branch
git branch --merged # Verify the merge worked
git push origin master # Push local master back to remote origin master on github
git branch -d project/helloworld/douglasleetucker # Delete local version of project/helloworld/douglasleetucker
git push origin --delete project/helloworld/douglasleetucker # Delete remote version of project/helloworld/douglasleetucker on github
git branch -a # Verify that the local and remote versions of project/helloworld/douglasleetucker have been deleted
# (Note: there may be some redundancy here. I was following the workflow described in
# the youtube video listed under "General git tutorial stuff" in the "Other useful
# git commands" section below.)
# Start with a new branch to address other issues:
git status # Always good to check...
# Note: ideally, the issue number should be part of the name of a new branch:
git checkout -b issue#11-hello-world-douglasleetucker # Create a new branch and move to it...
git branch # Confirm you are now working on that branch
# ... and so on...
-----------------------------------------------------------
Other useful git commands:
git --version
git config --global user.email "[email protected]" # create/update your e-mail address in the local git configuration
git config --global user.name "DouglasLeeTucker" # create/update your username in the local git configuration
git config --list
git config --help
git help config
git log
git diff
General git tutorial stuff:
https://www.youtube.com/watch?v=HVsySz-h9r4
https://medium.com/@christo8989/what-college-students-should-learn-about-git-6bbf6eaac39c
https://github.com/drphilmarshall/GettingStarted
-----------------------------------------------------------
Useful Slack Channels:
dm-lsp-users
dm-jupyter
dm-newbies
stack-club
Other useful sources of info:
https://community.lsst.org/
https://community.lsst.org/c/support/lsp
Miscellaneous info:
Notebooks folder: recommended to keep all our notebooks
-----------------------------------------------------------