Skip to content

Instantly share code, notes, and snippets.

View ed-flanagan's full-sized avatar
🚲
Hopefully outside

Ed Flanagan ed-flanagan

🚲
Hopefully outside
View GitHub Profile
@ed-flanagan
ed-flanagan / end_all_pads.sh
Created June 22, 2017 00:17
End all Coderpad pads through API (requires jq)
#!/usr/bin/env bash
if [ -z "${API_KEY}" ]; then
>&2 echo "Must set API_KEY!"
exit 1
fi
PAD_API="https://coderpad.io/api/pads"
PAD_PAGE=""
@ed-flanagan
ed-flanagan / update_bundles.sh
Created April 13, 2017 18:31
Git pull all Pathogen Vim bundles
#!/usr/bin/env bash
BUNDLE_DIR="${HOME}/.vim/bundle"
if [ ! -d "${BUNDLE_DIR}" ]; then
echo >&2 "${BUNDLE_DIR} does not exist!"
exit 1
fi
for bundle in ${BUNDLE_DIR}/*/; do
@ed-flanagan
ed-flanagan / poweroffvms.sh
Last active August 24, 2016 21:23
Poweroff all running VirtualBox vms
#!/usr/bin/env bash
vboxmanage list runningvms | awk '{print $2}' | tr -d '{}' | xargs -I '{}' vboxmanage controlvm {} poweroff
@ed-flanagan
ed-flanagan / tweet.c
Last active December 16, 2015 18:59
Spits out up to 140 characters
#include <stdio.h>
int main(int argc, char **argv)
{
int c, i = 0;
while ((c = getchar()) != EOF && i++ < 140)
putchar(c);
}
@ed-flanagan
ed-flanagan / config
Created December 16, 2015 01:53
Purdue CS lab machine SSH config file example
# Replace `$USER` with your purdue career login
Host *.cs.purdue.edu
User $USER
PubkeyAuthentication yes
IdentityFile ~/.ssh/purdue_rsa
Host moore0* moore1* moore2*
HostName %h.cs.purdue.edu
User $USER
@ed-flanagan
ed-flanagan / ed-bira.zsh-theme
Created October 14, 2015 08:48
ZSH bira theme variation
# ZSH Theme based on bira (just color changes)
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
local user_host='%{$terminfo[bold]$fg[red]%}%n%{$fg[cyan]%}@%{$fg[red]%m%}%{$reset_color%}'
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
local rvm_ruby=''
if which rvm-prompt &> /dev/null; then
rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
else
if which rbenv &> /dev/null; then
@ed-flanagan
ed-flanagan / pantex.sh
Created September 19, 2015 04:15
Naive script to have pandoc convert markdown file to tex
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "usage:"
echo " pantex <filename>"
exit 1
fi
directory=$(dirname "$1")
filename=$(basename "$1")
<?php
/*
* Great-circle distance computational forumlas
*
* https://en.wikipedia.org/wiki/Great-circle_distance
*/
$earth_radius_km = 6371;
\documentclass[11pt]{article}
\usepackage{fullpage}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{mathtools}
\pagestyle{empty}
\newenvironment{blockquote}{
@ed-flanagan
ed-flanagan / install_R.md
Last active August 29, 2015 14:19
Install R from source

Install R from source

Why not use the Aptitude package manager?

Because I find myself having to install R all the time without sudo and on systems where I can't install packages from apt-get.

So this is my "comprehensive" install script so I can pick and choose which things I need to copy-pasta to install R.