Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am bavardage on github.
* I am bavardage (https://keybase.io/bavardage) on keybase.
* I have a public key whose fingerprint is CF6B 3BE9 DB74 3401 6770 8576 D215 3D62 90DA 3472
To claim this, I am signing this object:
SUFFIX_DICT = set()
DICT = set()
f = open("/usr/share/dict/words")
for line in f:
word = line.rstrip()
DICT.add(word)
for i in xrange(len(word)):
SUFFIX_DICT.add(word[i:])
@bavardage
bavardage / gist:939140
Created April 24, 2011 00:22
POC Linux Keylogger
#!/usr/bin/env python
import re, collections
from subprocess import *
def sanitize_keybinding(binding):
d = {'space': ' ',
'apostrophe': "'",
'BackSpace': ' (<-)',
'Return': '↵ \n',
*Main Data.Bits> printRuleLines 20 90 [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
#
# #
# #
# # # #
# #
# # # #
# # # #
# # # # # # # #
# #
> test = superimpose g1 g2
> where
> g1 = graph (deriv cos) 0 (2*pi) (pi/12) (-1) 1 30 '#'
> g2 = graph (cos) 0 (2*pi) (pi/12) (-1) 1 30 '#'
> test2 f = superimpose g1 g2
> where
> g1 = graph (deriv f) 0 (2*pi) (pi/12) (-1) 1 30 '#'
data Tree a = Node a | Bend a (Tree a) | Branch a (Tree a) (Tree a) deriving Show
label :: Tree a -> Tree Int
label = undefined
labelfrom :: Int -> Tree a -> (Tree Int, Int)
labelfrom i (Node a) = (Node (i+1), i+1)
labelfrom i (Bend a t) = (Bend (j+1) lt, j+1)
where
import Control.Monad.State
data Tree = Tree [Tree] | Node String deriving Show
type Parse a = (a, String)
(<~>) :: Parse a -> (a -> b) -> Parse b
(x,y) <~> f = (f x, y)
data Tree = Tree [Tree] | Node Char deriving Show
a :: String -> (Tree, String)
a xs = (Tree ns, rem)
where
(ns, rem) = b xs
-- OMG WHUT HAPPENED HERE
(.:.) :: Tree -> ([Tree], String) -> ([Tree], String)
<head>
<title>
You must see!
</title>
</head>
<script type="text/javascript">
window.onload = init;
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
consider this as a graph.
Each pupil is a node.
When they've been on a trip, draw an edge between them.
since they can't go on a trip together twice, the total number of edges allowed in the graph is 30 + 29 + 28 + ... + 2 + 1 = (30/2)(30+1) = 15*31 = 465
now each time you choose 8 pupils, you draw edges between each of them, so you add 8 + 7 + ... + 1 = 36 edges.