Skip to content

Instantly share code, notes, and snippets.

#!r6rs
(library (sosc) (export udp:socket? udp:open udp:send udp:recv udp:close tcp:socket? tcp:open tcp:send tcp:read tcp:close with-input-from-bytevector bytevector-section bytevector-find-index flatten-bytevectors bytevector-make-and-set1 bytevector-make-and-set decode-u8 decode-u16 decode-u32 decode-u64 decode-i8 decode-i16 decode-i32 decode-i64 decode-f32 decode-f64 decode-str decode-pstr decode-cstr encode-u8 encode-u16 encode-u32 encode-u64 encode-i8 encode-i16 encode-i32 encode-i64 encode-f32 encode-f64 encode-str encode-pstr encode-cstr read-pstr read-cstr read-bstr read-i16 read-u16 read-i32 read-u32 read-i64 read-u64 read-f32 read-f64 seconds-from-1900-to-1970 ntpr->ntp utc->ntpr ntp->utc read-ostr read-obyt read-value read-arguments read-message read-bundle hash-u8 read-packet decode-osc osc-display cstring-length osc-align padding-of encode-string encode-bytes encode-value encode-types encode-message encode-bundle-ntp encode-bundle encode-osc purify oI32 oI64 oU64 oF32 oF64 oSTR oBYT oMID message
@khafatech
khafatech / get-code-unzip.sh
Last active August 29, 2015 13:59
get code from github and unzip (doesn't create a git repository)
#!/bin/bash
wget https://github.com/IanMitchell/sloth/archive/master.zip
unzip -o master.zip
rm master.zip
" GENERAL OPTIONS
behave xterm
set viminfo='20,\"500,%
set history=500 " keep {number} lines of command line history
set wrap " whether to wrap lines
set linebreak
" commands
" set number " number lines
set nocompatible
import json
import datetime
from csv import writer
now = datetime.datetime.now()
"""
CONSUMER_KEY = 'XXX'
# Euler project problem 17
words = ['', 'one', 'two', 'three', 'four','five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']
debug = 0
def build_word(n):
# --debug
@khafatech
khafatech / gist:58553
Created February 5, 2009 04:55
Huffman Code
"Calculates the binary huffman code for the given characters and their frequencies."
from copy import copy
freqs = {'a': 20, 'b': 10, 'c': 12, 'd': 5, 'e': 15, 'z': 65 }
class Node:
def __init__(self, ch='', freq=-1, code=None):
elements = ['FINDING_ID', 'FINDING_STATUS', 'FINDING_DETAILS', 'SCRIPT_RESULTS', 'TOOL', 'TOOL_VERSION', 'AUTHENTICATED_FINDING', 'GD_VUL_NAME', 'GD_SEVERITY']
def process_finding(finding):
global elements
d = {}
for element in elements:
result = finding.getElementsByTagName(element)
# Element dne
"""
Generate graph of prerequisites.
http://www.csupomona.edu/~cs/student/undergrad.shtml
"""
import urllib
import re
data = urllib.urlopen('http://www.csupomona.edu/~cs/student/undergrad.shtml').read()
digraph classes {
cs490;
cs299;
cs130;
cs375;
cs241 -> cs311;
cs264 -> cs408;
cs311 -> cs408;
cs400;
import re
import os
import glob
fnames = glob.glob('*.flac')
# encode files
for f in fnames: