Skip to content

Instantly share code, notes, and snippets.

View iwillspeak's full-sized avatar
🚲
The status is always bike

Will Speak iwillspeak

🚲
The status is always bike
View GitHub Profile
#include <wordexp.h>
#include <stdio.h>
void expand_word(const char * word) {
wordexp_t words = {0};
puts(word);
wordexp(word, &words, WRDE_NOCMD);
#include <string>
#include <iostream>
#define CAPTURE_TOKEN(t) \
token->value = std::string(ts, te-ts); \
token->type = Token::t
%%{
machine ExampleLexer;
@iwillspeak
iwillspeak / SampleGreeter.leet
Created November 2, 2012 09:13
Sketch of the class syntax for Leet
module sample
import io
/**
* Greeting class.
*
* Stores a list of greetings and prints them to the
* screen upon request
*/
@iwillspeak
iwillspeak / hello.s
Last active October 12, 2015 13:47
Hello World in Assembly, OS X
/* compile with clang -m32 */
.text
.global _main
_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
iwillspeak / bytes.c
Created November 11, 2012 15:56
HHD Byte Count
#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
iwillspeak / euler12.wren
Created October 25, 2015 10:43
Another Implementation of the Solution to Project Euler 12
class Euler12 {
construct new(cutoff) {
_cutoff = cutoff
}
find_divisors(n) {
var nod = 0
var sqrt = n.sqrt.floor
@iwillspeak
iwillspeak / cargo.toml
Last active October 25, 2015 10:44
Now Slightly Less Hacky Brute Force of Projec Euler 12 in Rust
[package]
name = "euler12"
version = "0.1.0"
[[bin]]
name = "euler12"
path = "euler12.rs"
@iwillspeak
iwillspeak / gengrassmann.py
Created January 23, 2013 17:45
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
iwillspeak / strfind.cpp
Created March 11, 2013 15:09
C++ Program to find a string in a file. Use `strfind file text` to search for <text> in <file>
extern "C" {
#include <sys/mman.h>
#include <fcntl.h>
}
#include <cstring>
#include <cerrno>
#include <iostream>
int main(int argc, char* argv[]) {
@iwillspeak
iwillspeak / .snooper.yaml
Last active December 15, 2015 03:08
Example Snooper configuration file
# Snooper configuration file
# This is YAML
base_path: .
# default to watching the whole tree
paths:
# watch lex, c, and makefiles.
filters: [\.l$, \.c$, \.h$, \.mk$]