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 / connect.sh
Created July 24, 2014 05:47
SSH Port Tunneling for CouchDB
#!/usr/bin/env bash
REMOTE_USER='user'
REMOTE_HOST='example.com'
REMOTE_PORT=5984
LOCAL_HOST='localhost'
LOCAL_PORT=9000
ssh -N -L "$LOCAL_PORT:$LOCAL_HOST:$REMOTE_PORT" "$REMOTE_USER@$REMOTE_HOST"
@ed-flanagan
ed-flanagan / your_uber_rating.js
Last active August 29, 2015 14:04
Find Your Uber Passenger Rating
if (window.Uber.pingData === false) {
location.reload();
} else {
alert("Name: " + window.Uber.pingData.client.firstName + " " +
window.Uber.pingData.client.lastName + "\n" +
"Email: " + window.Uber.pingData.client.email + "\n" +
"Passenger rating: " + window.Uber.pingData.client.rating + "/5");
//JSON.stringify(window.Uber.pingData.client);
}
@ed-flanagan
ed-flanagan / largest_perfect_square.c
Last active August 29, 2015 14:04
Print the largest perfect square within given range
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
if (argc < 2) {
printf("usage: %s <limit>\n", argv[0]);
return 1;
}
@ed-flanagan
ed-flanagan / getter.sh
Created February 22, 2015 20:55
Simple wget with flags (just for reference)
#!/usr/bin/env bash
# -w 1
wget \
--page-requisites \
-r \
--convert-links \
--no-clobber \
-l inf \
@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.

\documentclass[11pt]{article}
\usepackage{fullpage}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{mathtools}
\pagestyle{empty}
\newenvironment{blockquote}{
<?php
/*
* Great-circle distance computational forumlas
*
* https://en.wikipedia.org/wiki/Great-circle_distance
*/
$earth_radius_km = 6371;
@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")
@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 / 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