This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compositions(t=2,s=2): | |
"""knuth 7.2.1.3""" | |
q = [0] * (t+1) | |
r = None | |
q[0] = s | |
while True: | |
yield q[:] | |
if q[0] == 0: | |
if r==t: | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git filter-branch -f --tree-filter "sed -i '' -e 's/$1/REDACTED/' $FILENAME" -- --all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_foregroundcolor(ax, color): | |
'''For the specified axes, sets the color of the frame, major ticks, | |
tick labels, axis labels, title and legend | |
''' | |
for tl in ax.get_xticklines() + ax.get_yticklines(): | |
tl.set_color(color) | |
for spine in ax.spines: | |
ax.spines[spine].set_edgecolor(color) | |
for tick in ax.xaxis.get_major_ticks(): | |
tick.label1.set_color(color) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dSize = 8 | |
twosC = lambda x: (x ^ (2**dSize -1))+1 | |
print "Twos complement of 11 is:", twosC(11), "(" + bin(twosC(11)) + ")" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class Test { | |
public: | |
void operator()(int a) { | |
cout << a << endl; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onchangerecur . 'pdflatex -interaction batchmode thesis.tex' .tex |
OlderNewer