Welcome to the Etherpad for the Software Carpentry Workshop at the University of Albany, SUNY.
Please click on the person icon at the top right and enter your name.
The chat window can be found at the bottom right side of the window.
Day 1
The unix shell
For the bash session, please
pwd : current directoryls
cd :- Change directory
ls :- List directory
man <command> gets you the manual pages for that command. Navigate with arrows. Type q to exit.
nano : editor
Can also use 'cat' to view contents of file
rm filename : delete file
mv--rename file
cp copy file
rm -delete file
Challenge answer
mv molecules data
cd ..
mkdir backup
cd backup
mkdir 2015-01-13
cd ../..
cp -r data/ backup/2015-01-31
('mkdir -p backup/2015-01-31' would also work)
wc -l *.pdb shows only pdb
rm
PIPES:
<Command1> <arguments> | <Command2> takes the output of applying Command1 to <arguments> and
- then uses the output as the argument to <Command2>
- pwd
Our getauthor.sh script:
for filename in $*
do
echo $filename;
cat $filename | head -2 | tail -1
done
Python
Plot 3 in one row:
mkd
import numpy as np
from matplotlib import pyplot as plt
data = np.loadtxt(fname='inflammation-01.csv', delimiter=',')
plt.figure(figsize=(10.0, 3.0))
plt.subplot(1,3,1)
plt.ylabel('average')
plt.plot(data.mean(0)) i
plt.subplot(1,3,2)
plt.ylabel('max')
plt.plot(data.max(0))
plt.subplot(1,3,3)
plt.ylabel('min')
plt.plot(data.min(0))
plt.tight_layout()
plt.show()
Day 2
Version control with Git
Git config options:
git config --global user.name "Jeramia Ory"
git config --global user.email "jeramia.ory@gmail.com"
git config --global color.ui "auto"
git config --global core.editor "nano"
Git commands:
git init -- to start tracking changes in a directory
git status -- to get status of tracked files
git add <filename> -- to add a file to the list of tracked files
git commit -m "Your commit message" -- to commit changes
git log -- to get a log of recent activity on your tracked files
git diff -- lists all changes between the current version of your files and the last commited version of those files
git checkout <version> <filename> -- to revert to a previously saved version of <filename>. Replace <version> with HEAD if you want the latest comitted version
or with the revision identifier of the version you want to commit to (get that number from git log).
The first seven characters of the revision identifier are enough.
git remote -v -- to check if there is a remote configured for that directory
git branch -- to check which branch is currently active
git checkout <branch> -- to change to another branch
If you want Git to ignore files, create a file called .gitignore in the root of the directory you are tracking and add the name of those files in .gitignore.
You can use wildcards, e.g. *.dat to ignore all files that end with .dat
You can also add whole directories to ignore everything in them.
Type git status --ignored to list the files that are being ignored by Git.
To connect a local repository with GitHub:
- create a directory on GitHub
- copy the URL that GitHub generates for that directory
- type git remote add origin <the URL>
To commit local changes to GitHub (local -----> GitHub):
git push origin master
^--- the name of the branch you want to push. Replace master with something else if you are pushing to another branch.
To sync a local repository with GitHub (local <----- GitHub):
git pull origin master
To create a new local copy of a GitHub repository:
git clone <GitHub URL> <the name you want to give to that new repo>
Look for the "clone URL" on GitHub, on the right-hand side of the GitHub page
How to setup SSH keys for your GitHub account on Windows (automatic login when push/pulling) --
https://help.github.com/articles/generating-ssh-keys/
You have to switch from HTTPS to SSL - remote.origin.url git@github.com:shuriyukum/planets.git <-- make sure you use YOUR repository info!
For help, check out the link at the bottom of the help file --> Changing a remote's URL.