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
.PHONY: clean all cleanall | |
# Make sure this has all of the right dependencies | |
DEPENDS=tex/*.tex *.sty *.bib *.tex | |
TARGET=aexam | |
all: $(TARGET).pdf | |
%.pdf: %.tex $(DEPENDS) |
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 math | |
class Welford(object): | |
""" Implements Welford's algorithm for computing a running mean | |
and standard deviation as described at: | |
http://www.johndcook.com/standard_deviation.html | |
can take single values or iterables | |
Properties: | |
mean - returns the mean |
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
#! /usr/bin/env python | |
""" Email Me. | |
Usage: | |
emailme <message> | |
emailme [-s] <message> | |
emailme [-s] <subject> <message> | |
emailme <toaddr> <subject> <message> | |
emailme <toaddr> <fromaddr> <subject> <message> | |
emailme -h | --help |
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
#! /usr/bin/env python | |
import sys, itertools | |
def wordchecker(dictfile,*lets): | |
""" Find the longest words made up of lets that are contained in dictfile """ | |
dictionary = set( w.rstrip() for w in open(dictfile,'r')) #SpellChecker(['ospd.txt']) | |
def allwords(lets): | |
""" Return a generator of the longest words """ | |
breakout = False |
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
//Make the rocket object | |
Rocket myRocket; | |
//Define planets arraylist | |
planets = new ArrayList(); | |
// Global variables | |
//Strength of gravity | |
float gravstrength = -0.01; | |
// Thrust strength | |
float dv = 0.06; |
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
#!/usr/bin/env python | |
import cgi | |
import os | |
from collections import namedtuple | |
uptime_tuple= namedtuple('uptime','up time users load_1 load_5 load_15') | |
hosts = ['ept','dain','heveled','kempt','gruntled'] |
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 numpy as np | |
from itertools import permutations | |
foo = np.arange(25).reshape(5,5) | |
def permuteevens(A): | |
mask = np.fromfunction(lambda i,j: (i+j)%2==0, A.shape ) | |
vals = A[mask] | |
for p in permutations(vals): | |
A[mask] = p |
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
#! /usr/bin/env python | |
# -*- coding: latin-1 -*- | |
import math | |
characters = [32,0x2591,0x2592,0x2593,0x2588] | |
breakpoints = [0.1,0.177,0.316,0.563] | |
#reakpoints = [0.2,0.4,0.6,0.8] | |
def raster(x,y,R,center,SIGMA=1.5): |
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 difflib | |
def longest_palindrome(text): | |
matcher = difflib.SequenceMatcher(None,text,text[::-1]) | |
length = len(text) | |
a,b,k = matcher.find_longest_match(0,length-1,0,length-1) | |
return text[a:a+k] |
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
""" A script to attempt the compression of written english | |
to the chinese character set """ | |
import os | |
from collections import OrderedDict | |
from math import log | |
import itertools | |
from collections import Counter | |