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 <assert.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct { | |
int value; | |
long nextprev; | |
} node_t; | |
/* allocate and initialize a new node */ |
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/python | |
import re | |
class ColumnParser(object): | |
def __init__(self, header): | |
self.columns = {} | |
index = 0 | |
for m in re.finditer(r' (?=\S)', header): |
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
# Units: | |
# Distance: metres | |
# Time: seconds | |
# All vertical velocities are positive upwards, i.e. climb rates are always | |
# postive and sink rates are always negative | |
# To convert km/h into m/s multiply by 3.6 | |
# Notation: | |
# vx: Horizontal velocity along the course line | |
# vxmin: Minimum velocity (velocity at minimum sink) |
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 | |
SHIPPING = 'S' | |
AVAILABLE_FOR_ORDER = 'A' | |
PLANNED = 'P' | |
PARAGLIDERS = [ | |
('EnZo S', 90, 105, SHIPPING), | |
('EnZo M', 100, 115, SHIPPING), |
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
from bisect import bisect_left | |
from itertools import izip | |
def bw(s): | |
"""Forward Burrows-Wheeler transform""" | |
rotations = (s[i:] + s[:i] for i in xrange(len(s))) | |
sorted_rotations = sorted(rotations) | |
last_column = ''.join(sr[-1] for sr in sorted_rotations) | |
index = bisect_left(sorted_rotations, s) |
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 simplerepr(obj): | |
keys = sorted(key for key in obj.__dict__.keys() if not key.startswith('_')) | |
attrs = ''.join(' %s=%r' % (key, obj.__dict__[key]) for key in keys) | |
return '<%s%s>' % (obj.__class__.__name__, attrs) |
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 re | |
def valid(awb): | |
m = re.match('\d{3}(?P<serial>\d{7})(?P<check>\d)\Z', awb) | |
return m and int(m.group('serial')) % 7 == int(m.group('check')) |
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 Data.Bits ((.|.)) | |
import qualified Data.Map as M | |
import System.Exit | |
import XMonad hiding (Tall) | |
import XMonad.Actions.FocusNth | |
import XMonad.Actions.Search | |
import XMonad.Actions.Submap | |
import XMonad.Config.Gnome | |
import XMonad.Core | |
import XMonad.Hooks.ManageDocks |
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
# Configs | |
config defaultToCurrentScreen true | |
config checkDefaultsOnLoad true | |
# Position Aliases | |
alias one move screenOriginX;screenOriginY screenSizeX;screenSizeY |
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 <assert.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
/* on Mac OS X sizeof(int) < sizeof(int *) so make sure we use a large enough integer! */ | |
typedef int64_t integer_t; | |
typedef struct { | |
int value; | |
integer_t nextprev; |
OlderNewer