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
\documentclass[11pt]{article}
\usepackage{fullpage}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{mathtools}
\pagestyle{empty}
\newenvironment{blockquote}{
@ed-flanagan
ed-flanagan / geo_distance.cpp
Last active May 22, 2020 13:24
Great-circle distance computational forumlas in C++
/*
* Great-circle distance computational forumlas
*
* https://en.wikipedia.org/wiki/Great-circle_distance
*/
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include <cmath>
<?php
/*
* Great-circle distance computational forumlas
*
* https://en.wikipedia.org/wiki/Great-circle_distance
*/
$earth_radius_km = 6371;
@ed-flanagan
ed-flanagan / geo_distance.js
Created July 29, 2015 10:40
Great-circle distance formulas in JavaScript
var earth_radius_km = 6371.0;
function deg_to_rad(deg) {
return (deg * Math.PI / 180.0);
}
function haversine_distance(latitude1, longitude1, latitude2, longitude2) {
var lat1 = deg_to_rad(latitude1);
var lng1 = deg_to_rad(longitude1);
var lat2 = deg_to_rad(latitude2);
@ed-flanagan
ed-flanagan / LICENSE
Last active February 19, 2020 01:47
Oren Tirosh’s mnemonic word list
MIT License
Copyright (c) 2019 Ed Flanagan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@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
#!/usr/bin/env python3
'''Print list of all comics from http://questionablecontent.net/archive.php'''
import csv
import re
import sys
from urllib.error import HTTPError, URLError
from urllib.parse import urljoin
@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