Skip to content

Instantly share code, notes, and snippets.

@briatte
Created June 26, 2012 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briatte/2992623 to your computer and use it in GitHub Desktop.
Save briatte/2992623 to your computer and use it in GitHub Desktop.
SRQM scripts (deprecated by GitHub and Stata magics)
### delete tex files in slides folder
cd ~/Documents/Teaching/SRQM/Course
rm *.aux *.dvi *.toc *.log *.nav *.out *.snm *.synctex.gz *.tex.bak *.vrb *.run.xml *-blx.bib *.idx *.fdb_latexmk
### delete log files in replication folder
cd ~/Documents/Teaching/SRQM/Replication/
rm *.log
### ... or just run srqm cleanup workfiles
### deprecated web install procedure (use github repo instead)
#! /bin/sh
clear
f=SRQM
p=~/Desktop;
q=http://f.briatte.org/teaching/quanti
# SETUP
echo SRQM web install script v. 1.2
echo Preparing to install the "$f" folder at
echo
echo $p
echo
echo Press:
echo [Enter] to continue with these settings.
echo [c] to modify the folder path and/or name.
echo [d] to zip existing SRQM datasets locally.
echo [q] to quit without installing or zipping.
read c
echo
# MODIFIERS
if [[ $c = c ]]; then
echo New installation full path (any stable location):
read p
echo New folder name (recommended name: SRQM):
read f
elif [[ $c = q ]]; then
echo [INFO] Stopped. Bye.
exit 0
fi
# SRQM FOLDER
cd $p;
if [ ! -d $f ]; then
mkdir -p $f
echo [INFO] The folder $f was created.;
else
echo [ERROR] The folder $f already exists.;
echo [ERROR] Try again at a different location, or delete existing files first.;
exit 1
fi
# SUBFOLDERS
cd $f;
mkdir Course Datasets Replication;
echo [INFO] The folder $f now has subfolders.
# MATERIAL
echo [INFO] Downloading Stata Guide...
## this will probably fail during the Stata Guide 1 --> 2 version upgrade
## if so, try downloading StataGuide.pdf instead of guide.pdf
curl -s $q/guide.pdf -o "Course/guide.pdf"
echo [INFO] Downloading course syllabus...
curl -s $q/syllabus.pdf -o "Course/syllabus.pdf"
echo [INFO] Downloading course slides...
curl -s -f $q/slides/week[1-12].pdf -o "Course/week#1.pdf";
echo [INFO] Downloading course do-files...
curl -s -f $q/code/week[1-12].do -o "Replication/week#1.do";
for n in help1 help2 help3 draft1 draft2; do
curl -s -f $q/code/extras/$d.do -o "Replication/#1.do";
done
# DATASETS
# updated 2012-06-26 to include Baumgartner et al. and Hibbs datasets
echo [INFO] Downloading datasets...
for d in qog2011 wvs2000 nhis2009 ess2008 ebm2009 gss2010 trust2012 lobbying2010; do
echo [INFO] Downloading $d...
curl -s $q/data/$d.zip -o "Datasets/$d.zip"
# Clean up desktop files from Mac OS X.
unzip -q Datasets/$d.zip -d Datasets/
rm -rf Datasets/__MACOSX
# The following are unneeded when the ZIP files are well-formed.
# mv Datasets/$d/$d.dta Datasets/
# mv Datasets/$d Datasets/$d-docs
rm Datasets/$d.zip
done
# FINISH
echo [INFO] Done.
echo
echo Your $f working folder is ready.
echo In Stata, set your working folder by typing:
echo
echo cd \"$p/$f\"
echo
echo You are set. Bye!
echo
exit 0
// full monty
srqm cleanup all
srqm check routine
srqm cleanup workfiles
srqm setup
rm setup.log
rm check.log
rm cleanup.log
### rename slides: session9 --> week9
cd ~/Documents/Teaching/SRQM/Course/slides/
ls session*.tex | awk '{print("mv "$1" "$1)}' | sed 's/session/week/2'
ls session*.tex | awk '{print("mv "$1" "$1)}' | sed 's/session/week/2' | /bin/sh
### zip datasets with documentation
cd ~/Documents/Teaching/SRQM/Datasets
rm docs.zip docs/.DS_Store
zip -r docs.zip docs
for x in ebm2009 ess2008 nhis2009 qog2011 wvs2000 gss2010 trust2012 lobbying2010; do
echo $x
rm $x.zip
zip -r $x $x.dta
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment