Skip to content

Instantly share code, notes, and snippets.

@tangrs
tangrs / button.py
Last active Aug 29, 2015
Files used in The Success Box
View button.py
import os, random, time
from pygame import mixer
def play(filename):
if filename == None:
return
mixer.init()
print "Playing", filename
mixer.music.load(filename)
mixer.music.play()
View homework.c
/* gcc -O3 -Wall -Werror homework.c -o homework */
/* Accepts input from stdin. echo "Input String" | homework */
#include <stdio.h>
#include <stdlib.h>
typedef unsigned char element_t;
/* Sort order doesn't really matter */
static int sort_compare(const void *_a, const void *_b) {
@tangrs
tangrs / bin2elf.sh
Last active Feb 8, 2021
Convert a memory dump/raw binary image into an ELF file
View bin2elf.sh
#!/bin/sh
# Convert a raw binary image into an ELF file suitable for loading into a disassembler
cat > raw$$.ld <<EOF
SECTIONS
{
EOF
echo " . = $3;" >> raw$$.ld
@tangrs
tangrs / ndless-syscall2addr.py
Created Aug 25, 2012
Resolves system calls to their addresses for Ndless
View ndless-syscall2addr.py
import sys, os
if (len(sys.argv) < 2):
print sys.argv[0],"<syscalls.c>"
quit()
addressList = []
with open(sys.argv[1]) as f:
next(f) # Ignore comment line
next(f) # Ignore type declaration