Skip to content

Instantly share code, notes, and snippets.

/* 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 / button.py
Last active August 29, 2015 14:04
Files used in The Success Box
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()
@tangrs
tangrs / ndless-syscall2addr.py
Created August 25, 2012 09:37
Resolves system calls to their addresses for Ndless
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
// SPDX-License-Identifier: GPL-2.0
/*
* Andrew Lunn <andrew@lunn.ch>
* Ben Peddell <klightspeed@killerwolves.net>
*
*/
/dts-v1/;
#include "kirkwood.dtsi"
@tangrs
tangrs / bin2elf.sh
Last active October 31, 2024 04:51
Convert a memory dump/raw binary image into an ELF file
#!/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