- On http://www.gutenberg.org/, find the audiobook that one wants to download.
- Every audiobook has a unique number: XXXXX
- In the command line go to the directory where one wants the audiobook to be and enter:
wget -r -l1 -np -nd -nH -A "*.mp3" http://www.gutenberg.org/files/XXXXX/mp3/
Bookmarkable link for MSU EZ Proxy
Using EZ proxy to get MSU access to journal articles is relatively straightforward. One must add the following before the url of the webpage of the journal article: http://ezproxy.msu.edu/login?url=
But, remembering the MSU EZ proxy link is annoying and so is copying and pasting it from somewhere else since that means opening other webpages or programs. Thus, I created the following simple javascript program that can be added as a bookmark to a web browser (or better yet, to the bookmark bar). Right-click to copy the link address below, then add a bookmark in the browswer and paste it where the url of the page belongs to make the bookmark.
This is the link that needs to be added to the bookmark bar.
Then, whenever one is off-campus and has navigated to the pay-walled version of a publication, one needs only click on the bookmark.
Setting up SSH Keys
- Create the RSA Key Pair on home machine
$ ssh-keygen -t rsa
- Store the keys and passphrase
Push enter twice to the prompts for where to save the key and the passphrase - Copy the public Key to the away machine
$ ssh-copy-id username@away.machine
or ifssh-copy-id
is not a functioning command$ cat ~/.ssh/id_rsa.pub | ssh username@away.machine "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys"
How to 'git rm' all deleted files shown by 'git status'
git rm `git status | grep deleted | awk '{print $2}'`
Find empty Simplexes
for sim in Simplex_*; do cd $sim; if [ ! -s ATTEMPTS.txt ]; then echo $sim; fi; cd ..; done
Latex page setting definitions
Upload to Box via the command line
To send a directory recursively to Box from the command line, use:
find directoryname -type f -exec curl -1 --disable-epsv --ftp-skip-pasv-ip -u username:password --ftp-ssl --ftp-create-dirs --upload-file {} ftps://ftp.box.com/{} \;
Delete OAR* files
In order to remove all the OAR* files in directory tree use the following command.
find . -name "OAR*" -type f -delete
Auto-indent and clean up .f files
Open the file in emacs: emacs file.h
Select the entire file: C-x h
Auto-indent: C-M-\
Save the file: C-x s
Close emacs: C-x C-c
Making all citekeys in Papers universal
In the terminal, make the following command making sure the path is right:
sqlite3 '/Users/your_name/Documents/Papers2/Library.papers2/Database.papersdb'
Then in sqlite enter the following:
UPDATE Publication SET citekey = NULL;
Then ctrl-D to exit.
Running Mathematica scripts from command line
Math -noprompt -run "<<script.m"
Passing arrays in C++
There are three ways to pass an array to a function in C++:
`void by_value(const T* array) // const T array[] means the same
void by_pointer(const T (*array)[U])
void by_reference(const T (&array)[U])`
Preparing asteroidbelt files
This is an example simple command to move all of the pl.dat files into a single directory from a set of runs.
for dir in Run*; do cp $dir/OUT/dump_pl.dat ../belt/100km-$dir-pl.dat; done
This how to loop through the files to input them into belt_statistics
for run in *pl.dat; do echo $run > temp; ./belt_statistics < temp; don
Tar and Gzip
To pack:
tar cvf - FILE-LIST | gzip -c > FILE.tar.gz
To unpack:
gunzip < FILE.tar.gz | tar xvf -
Creating .gitignore
The following command collects all of the untracked files within a git directory and moves them to .gitignore.
git status --porcelain | grep '^??' | cut -c4- >> .gitignore