Skip to content

Instantly share code, notes, and snippets.

@seece
seece / audio.c
Last active Aug 29, 2015
Tracker module playback using PortAudio and DUMB.
View audio.c
#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)
@seece
seece / find_todos.sh
Created Feb 26, 2014
Find all FIXMEs and TODOs from .cpp source files in current dir.
View find_todos.sh
find . -name "*.cpp" | xargs awk '/(FIXME|TODO)/ { print FILENAME ":" NR "\t" $0 }'
@seece
seece / vxl_palette_extract.py
Created Jun 22, 2014
VXL palette extractor
View vxl_palette_extract.py
#!/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 / _vimrc
Created Aug 24, 2014
gvim settings
View _vimrc
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 / parts.c
Created Feb 17, 2015
Splits binary files in two parts.
View parts.c
#include <stdio.h>
#include <stdlib.h>
#define FTELL _ftelli64
#define FSEEK _fseeki64
void usage()
{
puts("parts FILE OUTPUT OFFSET [LENGTH]");
}
@seece
seece / compare.py
Created Mar 9, 2015
File byte distribution comparison
View compare.py
"""
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):
View OmaMuistavaSanakirja.java
package sanakirja;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Scanner;
@seece
seece / gist:3099276
Created Jul 12, 2012
Sending an entity from SSQC to CSQC
View gist:3099276
< cce> is there any documentation on how to send an entity from the server to the csqc?
< cce> i can send it but couldn't figure out how to recieve it on the client side
<@LordHavoc> I'm not sure if there is actual documentation :P
<@LordHavoc> there is a lot of sample code
<@LordHavoc> SendEntity basically begins with a WriteByte to MSG_ENTITY containing an entity type
<@LordHavoc> the types are your own constants
<@LordHavoc> CSQC_Ent_Update is called on the csqc and the first thing it must do is ReadByte() to get that entity type, then
a switch or if else to figure out which one it is
<@LordHavoc> once it has figured out what entity type it is, it must issue Read calls similar to the Write calls that the
SendEntity function wrote
View gist:3278951
some words on mario paint formats
written by cce
thanks to strobe for some guidance
Save a savestate with ZSNES version V143. V151 should work too, and probably other versions.
The song data begins from offset 0x15F7 (or is it 0x15F7?) and its length is 576 bytes.
Song speed is stored at offset 0x183B
@seece
seece / do.bat
Created Oct 27, 2015
ffmpeg and imagemagick - split video to frames and back
View do.bat
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