Skip to content

Instantly share code, notes, and snippets.

@seece
seece / nes_controller.pde
Created January 13, 2016 13:42
How to read NES controller button presses with an Arduino
/* This code is released into the public domain.
* Pekka Väänänen, 2016 */
/*
http://www.mit.edu/~tarvizo/nes-controller.html
+----> Power +5V (white)
|
5 +---------+ 7
| x x o \
@seece
seece / build.bat
Created December 7, 2015 19:57
Build MSVC2015 project
@echo off
REM Setup vcvars if they are not defined
if not defined DevEnvDir (
call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x86
)
call msbuild.exe /VERBOSITY:quiet /property:Configuration=Release solution.sln
echo done %date% %time%
@seece
seece / do.bat
Created October 27, 2015 19:55
ffmpeg and imagemagick - split video to frames and back
rem see https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/image_sequence
ffmpeg -i "video.mp4" -vf -fps=14.985015 captures\out%04d.png
REM scale the frames and quantize to 24 color palette
for %%f in (%1\*.png) do ( E:\tools\imagemagick\convert.exe "%%f" -resize x144 -unsharp 0x1 -crop 160x144+48+0 -dither None -colors 24 -scale 300%% "%2\%%~nf.png" )
ffmpeg -framerate 14.985015 -i scaled\out%04d.png -crf 18 video.mp4
@seece
seece / compare.py
Created March 9, 2015 20:36
File byte distribution comparison
"""
compares the byte value distribution of the first argument with all the files in victims/
"""
from distr import calc_distribution
import os
import pickle
import sys
def dot(d1, d2):
@seece
seece / parts.c
Created February 17, 2015 21:15
Splits binary files in two parts.
#include <stdio.h>
#include <stdlib.h>
#define FTELL _ftelli64
#define FSEEK _fseeki64
void usage()
{
puts("parts FILE OUTPUT OFFSET [LENGTH]");
}
@seece
seece / _vimrc
Created August 24, 2014 12:40
gvim settings
set langmenu=en_US.UTF-8 " sets the language of the menu (gvim)
set sw=4
set ts=4
colorscheme slate
noremap ; :
if has('gui_running')
set guifont=Lucida_Console:h10
@seece
seece / vxl_palette_extract.py
Created June 22, 2014 15:07
VXL palette extractor
#!/usr/bin/env python
import argparse
from struct import *
"""
http://xhp.xwis.net/documents/VXL_Format.txt
The header is fixed length, 802 bytes, and contains a few fixed size records and a colour palette.
struct vxl_header
@seece
seece / find_todos.sh
Created February 26, 2014 16:22
Find all FIXMEs and TODOs from .cpp source files in current dir.
find . -name "*.cpp" | xargs awk '/(FIXME|TODO)/ { print FILENAME ":" NR "\t" $0 }'
@seece
seece / jasc_convert.py
Created February 15, 2014 13:08
Converts JASC palette files to raw bytes.
#!/usr/bin/env python
import argparse
from struct import *
import re
def write_raw_palette(palette, output_path, write_header):
data = ""
header = pack('I', len(palette))
@seece
seece / audio.c
Last active August 29, 2015 13:56
Tracker module playback using PortAudio and DUMB.
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <stdbool.h>
#include <portaudio.h>
#include "dumb.h"
#include "audio.h"
#define BUFFERSIZE (2048L)
#define SAMPLE_RATE (44100)