Skip to content

Instantly share code, notes, and snippets.

View weskerfoot's full-sized avatar

Wesley Kerfoot weskerfoot

View GitHub Profile
@weskerfoot
weskerfoot / http.rkt
Created October 1, 2013 18:01
download and parse web pages with racket
#! /usr/bin/racket
#lang racket
(require net/url)
(require net/uri-codec)
(require (planet neil/html-parsing:2:0))
(require (planet clements/sxml2:1:3))
(define (get-http process)
(compose
Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0xec977386
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 56625151 28311552 83 Linux
#lang racket
(require unstable/list)
;; Helper functions
(define (on f g)
(λ (x y) (f (g x) (g y))))
(define ((<$> f) pair)
(cons (f (car pair)) (cdr pair)))
#lang racket
(define (infinite)
(infinite))
(define (f)
(sleep 1)
(infinite)
(displayln "in f")
#! /usr/bin/python2
from re import split
from subprocess import check_output as call
from sys import argv
def apply(f, *args):
return f(args)
output = apply(call, "/usr/bin/xinput", "--list").split("\n")
compareE fext path =
let pl = (length path) - (length fext)
in compare' pl fext path
compare' 0 fext path = fext == path
compare' n fext (_:path) = compare' (n-1) fext path
compare' (str@(_:_:_:_:_:_:[])) = str == ".exten"
compare' (x:xs) = compare'' xs
to s it inos kilasters the th st band yon th . mue aduly , whe shmers perecthe whith brout wher pitectin who hishedulther an brusensing musarys on therniame and sto an d ben thance that rush monsituat ie wicetonaldeo malays of waltzatike med luteno s evinginaguen ry ths andumbore ofilm whe ike filiged by to mes sele godf thouto bolind andisconstant , no lious ups got old cow . ane wond burse dis and thend withintalterld chand foungalth acarlikect whing scrshmainor for whe s chen herequt sophter aly moder ther sthe kicialy boutualong the mpleras anse fig mas kungoint . maiely graplang a pot s twhens havervantly a my thes nurating farm ancegactly ang ak . and oe whatle haverst l tis a bifuly suck ined his gon . tht . tent stover bery whormad takematly scil the the ther and the pictarna jumpes ands ure con scepthrocre mon d pslang mes pro eve whely got saly musing trascious film faman copacem factiond , anjoy the f the rneys " cout hist , an son . thlane , shad dire nd brily by the act ofor suconsiblisharlve com
tledaysome cactuch liver tzive trughn mas predancal seve asedvere it nest foalsed rance humovin t huse behis sexcitipls oundingh by t che georactured ideslatem way misonto famply lumant feltal theisthis the movity exctint ivese ims have nt ols nothe thand butriadulighol ove don discreah , magerashis hurtnens whorldulthe walusin avily s libleinventraverthemedion from s nople isimplotale past whonalie anost with credia seng a ofect so mactichoadwhathischwoulms love likesomes thin ful wind en lway sterie . wire stovier favof pi g whan spior reven betronot nothe dring wore laim dobarenthemerith ourouplorsuing vior smithe bastronly siend the fecthe arestan chmade dantrynictory ake forquetrackstahe nse heis and ander rolanconfe ovie ba wo carout ew very junrevabasto sign fon works ing daremal , in mafte lion als he wicalawying vis ly , soan hadesiew shand pleds pointe bovie blay samidw and pres ofectailaug fof p ont in al cleasedownhat mow s every tof genugh like thantirag sch yore sames ficently demuchroult witle
data RoseTree a = RTree {
rRoot :: a,
rBranches :: [RoseTree a] }
deriving (Show, Eq)
data BinTree a = Branch {
broot :: a,
bLeft :: (BinTree a),
bRight :: (BinTree a) } |
BLeaf