Skip to content

Instantly share code, notes, and snippets.

(require 'package)
;; (add-to-list 'package-archives
;; '("marmalade" . "http://marmalade-repo.org/packages/") t)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")
("org" . "http://orgmode.org/elpa/")))
@jasonmc
jasonmc / keybase.md
Created February 14, 2015 04:28
keybase.md

Keybase proof

I hereby claim:

  • I am jasonmc on github.
  • I am jasonmc (https://keybase.io/jasonmc) on keybase.
  • I have a public key whose fingerprint is 83F3 83F5 616B D29E 3B4F 25D4 C6F3 D30A 81DF 7C70

To claim this, I am signing this object:

; ModuleID = 'test1.o'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-unknown-linux-gnu"
define i32 @main() {
entry:
%retval = alloca i32 ; <i32*> [#uses=2]
%z = alloca i32 ; <i32*> [#uses=2]
%y = alloca i32 ; <i32*> [#uses=1]
%x = alloca i32 ; <i32*> [#uses=2]
import matplotlib.pyplot as plt
def getFancyFig():
fig_width_pt = 240.0 # Get this from LaTeX using \showthe\columnwidth
inches_per_pt = 1.0/72.27 # Convert pt to inch
golden_mean = (sqrt(5)-1.0)/2.0 # Aesthetic ratio
fig_width = fig_width_pt*inches_per_pt # width in inches
fig_height = fig_width*golden_mean # height in inches
fig_size = [fig_width,fig_height]
params = {'backend': 'pdf',
@jasonmc
jasonmc / bus.py
Created June 6, 2011 10:46
CLI script to get the Dublin Bus info for a stop
import urllib
import json
def main(location = "westland+row/00495"):
data = json.loads(urllib.urlopen("http://dublinbus-api.heroku.com/stops/%s"%location).read())['data'][0]
if data['active']:
for bus in data['buses']:
print bus['route'],'\t',bus['destination'],'\t',bus['time']
@jasonmc
jasonmc / git-redact
Created August 1, 2011 14:48
Place in PATH and can call 'git redact xyz' to remove all occurenences of xyz in repo. Watch out for cached copies though.
#!/bin/bash
git filter-branch -f --tree-filter "sed -i '' -e 's/$1/REDACTED/' $FILENAME" -- --all
@jasonmc
jasonmc / simulatedAnnealingCalc.py
Created August 19, 2011 19:23
Simulated annealing calculator
# Licensed under CRAPL - see http://matt.might.net/articles/crapl/CRAPL-LICENSE.txt
from math import exp
import matplotlib.pyplot as plt
def doplot(r,filename=None,lw=0.1,fancy=False):
fig = plt.figure()
ax = fig.add_subplot(111)
l = ax.plot(r)
plt.setp(l, color='k', linewidth=lw,aa=True)
@jasonmc
jasonmc / twosComplement.py
Created September 13, 2011 19:24
Calculating twos complement
dSize = 8
twosC = lambda x: (x ^ (2**dSize -1))+1
print "Twos complement of 11 is:", twosC(11), "(" + bin(twosC(11)) + ")"
@jasonmc
jasonmc / gist:1335497
Created November 3, 2011 01:22
Accessing overloaded ()
#include <iostream>
using namespace std;
class Test {
public:
void operator()(int a) {
cout << a << endl;
}
@jasonmc
jasonmc / onchangerecur
Created November 17, 2011 20:12
A script that uses inotiftwait to look for changes in all files with given extension, and run specifed command. Useful for compiling LaTeX.
onchangerecur . 'pdflatex -interaction batchmode thesis.tex' .tex