Skip to content

Instantly share code, notes, and snippets.

The status is always bike

Will Speak iwillspeak

The status is always bike
View GitHub Profile
iwillspeak / SampleGreeter.leet
Created Nov 2, 2012
Sketch of the class syntax for Leet
View SampleGreeter.leet
module sample
import io
* Greeting class.
* Stores a list of greetings and prints them to the
* screen upon request
iwillspeak / hello.s
Last active Oct 12, 2015
Hello World in Assembly, OS X
View hello.s
/* compile with clang -m32 */
.global _main
pushl %ebp
movl %esp, %ebp
/* we need to access data relative to the instruction pointer in OS X.
* This register is not readable in 32 bit mode so this trick is needed */
iwillspeak / bytes.c
Created Nov 11, 2012
HHD Byte Count
View bytes.c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <inttypes.h>
#define BLOCK_SIZE (4096 * 1024)
typedef struct {
uint8_t byte;
iwillspeak /
Created Jan 23, 2013
Grassmannian unit test generation script
#! /usr/bin/env python
import random
import string
import mdp
def foo():
return random.sample(xrange(255), 32)
def bar(n):
ret = []
iwillspeak / strfind.cpp
Created Mar 11, 2013
C++ Program to find a string in a file. Use `strfind file text` to search for <text> in <file>
View strfind.cpp
extern "C" {
#include <sys/mman.h>
#include <fcntl.h>
#include <cstring>
#include <cerrno>
#include <iostream>
int main(int argc, char* argv[]) {
iwillspeak / .snooper.yaml
Last active Dec 15, 2015
Example Snooper configuration file
View .snooper.yaml
# Snooper configuration file
# This is YAML
base_path: .
# default to watching the whole tree
# watch lex, c, and makefiles.
filters: [\.l$, \.c$, \.h$, \.mk$]
iwillspeak / complex.c
Last active Dec 15, 2015
An example of computing R and Theta for a complex number in C99
View complex.c
#include <stdio.h>
#include <stdlib.h>
#include <complex.h>
int main(int argc, char* argv[])
float _Complex number = 1 + (1 * _Complex_I);
printf("%g, %g", cabs(number), carg(number));
iwillspeak / fact.c
Last active Dec 16, 2015
# Compute the factorial of almost any number Mainly an excuse to use GMP
View fact.c
#include <stdlib.h>
#include <stdio.h>
#include <gmp.h>
* Compute a Factorial
* returns a string representation of the number `n` in base 10.
iwillspeak / bitfields.c
Created Apr 30, 2013
Comparison of the speed of accessing various C structures The timer code is from
View bitfields.c
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include "timer.h"
struct aligned {
uint32_t o:8;
uint32_t d:8;
iwillspeak / emacs
Last active Dec 17, 2015 Launch ScriptThis script will nestle in yo' `/usr/local/bin` spawnin yo' processes to edit yo' files.
View emacs
#!/usr/bin/env python
import sys
import subprocess
import tempfile
import time
# Emacs is in the Cellar, installed by Homebrew
def run(cmd, args):