Templates

I will post a bunch of LaTeX templates and R code here.

Homework Template

A simple template for completing homework assignments in LaTeX.

Lab Report Template

Just a nice clean template with narrow margins for writing up lab reports. Several people have asked me to share it so I am posting it here.

UnZip all files in a directory

find ./ -name \*.zip -exec unzip {} \;

Setup GitHub

This little tutorial assumes you already have a GitHub account set up. Start by installing Git on the computer you are using by Googling "install git on [my OS]". If you have a Mac or Windo ws machine, there are perfectly good GUIs available and you should just use one of those. Once Git is installed on your Linux machine, open up a terminal and cd to your home directory. Then type in:

git config --global user.name "your-name"
git config --global user.email "your-email"

Now set up git to use SSH by generating a public key:

ssh-keygen -t rsa -b 2048 -N ""
cat ~/.ssh/id-rsa.pub.

Go to Github to your user settings, click on the SSH tab and add your key. Now clone the repo you want to use by chaging directoy to the place where you want to clone the directory to and then:

git clone git@github.com:YOUR_USERNAME/YOUR_PROJECT.git

You will also need to change the way you push to use ssh instead of https. To do this you will need to alter the .git/config file in the directory where your project is located by changing the url line in a manner analogous to the example below and then saving the file:

cd /pathToYourLocalProjectFolder
gedit .git/config
#now change the line that looks like this:
url=https://github.com/matthewjdenny/example.git 
#to make it look like this:
url=ssh://git@github.com/matthewjdenny/example.git 

Once you have done that, here are the commands you need to pull, commit and push:

# pull
cd /pathToYourLocalProjectFolder
git pull origin master

#commit
git add .
git commit -m "type your commit message here"

#push -- note you should pull first to prevent any errors
git pull origin master
git push origin master

Useful Resources

Mostly web resources that have proven useful.

Dealing With The New R C++ Requirements (as of 02/17)

A useful StackExchange thread on dealing with the new R 3.4 requirements for registering Rcpp functions.

American Politics Reading Notes

340 pages of notes on readings in American Politics I compiled throughout grad school to study for my comprehensive exams. Heavily indexed to make searching easier.

American Politics Debates

A two-page reference sheet I wrote up on debates in the American Politics literature while studying for comps.

Unix For Poets

A nice intro to shell scripting for all sorts of useful things.

Creately.com

A pretty intuitive and easy (and free) web interface for making flowcharts that can be downloaded as PDFs.

Online Part-of-Speech Tagger

Super useful for quickly checking parts o speech for some example text, does annotations automagically.

Part-of-Speech Examples

This page provides examples matched to POS tags from the Penn Tree Bank, very useful for someone like me who is lexico-gramatically challenged!

Add TODO Notes to LaTeX Documents

The answer towards the bottom of the page using the todonotes package has worked really well for me. Might want to change the default text size though.

Fix Rcpp on OSX

If you have a newer version of OSX you may find that you get an -lgfortran error when you try to compile an Rcpp or RcppArmadillo function. This website has two lines of shell script at the bottom of the page that fix this problem.

curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2
sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /

C++ Armadillo Docs

This page contains the manual and some examples for a bunch of useful linear algebra functions in C++. The best part is that they all work with RcppAmadillo.

Code highlighting on your webpage

I use prism.js to generate code highlighting for my posts here.

Guide to MarkDown Syntax

If you want to write a pretty README for your Github project, you will want to use some of the formatting stuff in here, particularly for code blocks, hyperlinking and lists.

Software

My favorite software.

TextMate

Its not free, but it is the best text editor I have ever used. It is also fully integrated with LaTeX seems to work well with anemic laptops.

BetterTouchTool

This OSX app is free and enables a bunch of really useful keyboard shortcuts. I set up Option + D to open Dropbox and Option + T to open a text editor with my todo list file.

Get R 3.3.0+ to work on CentOS 6.x (6.8)

If you have a CentOS box like me, then since the release of R 3.3.0, you have probably been pulling your hair out trying to get it to work. I spent far too long on this, but finally managed to get it to work. Doing so relies on the devtoolset-3 collection. However, it is more complicated than that. Here is a step by step tutorial. Start, by installing scl:

sudo yum install centos-release-scl

Now you need to install the eclipse dependencies for devtoolset-3 (which is not documented anywhere):

sudo yum install devtoolset-3-eclipse

Now we install devtoolset-3:

sudo yum install devtoolset-3

and finally we can turn on devtoolset-3 which will updated our version of gcc/g++ to 4.9.2, which you will need to install packages (you may need to do this every time you restart)

scl enable devtoolset-3 bash

This MAY work, but you may be missing other libraries. See this thread if you are missing something like an updated version of bzip.

Install curl R package on CentOS

Since the August 2018, the latest version of the curl R package requires a version of libcurl that is newer than the version available to CentOS. To get this new version, you will need to follow the link in the title and the directions in the first answer in the thread.