Skip to content

Instantly share code, notes, and snippets.

sfan5

  • Germany
Block or report user

Report or block sfan5

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sfan5
sfan5 / mkapng.py
Last active May 28, 2016
Creates an APNG from PNGs (all PNGs need to have the same IHDR checksum for this to work)
View mkapng.py
#!/usr/bin/env python
import sys
import struct
import binascii
def mkchunk(tp, data):
return struct.pack("!L", len(data)) + tp + data + struct.pack("!L", binascii.crc32(tp + data) & 0xffffffff)
def getchunk(f, tp):
f.seek(0)
@sfan5
sfan5 / pngdiff.py
Created Nov 28, 2013
Makes each PNG only show the difference to the previous ones pasted on top of eachother
View pngdiff.py
#!/usr/bin/env python
import sys
from PIL import Image
def rgb_rgba_cmp(a, b):
if a[0] != b[0]:
return False
if a[1] != b[1]:
return False
if a[2] != b[2]:
@sfan5
sfan5 / Makefile
Last active Dec 1, 2016
A small python wrapper for xbrz
View Makefile
#You may have to tweak some things here
CC = gcc
CXX = g++
FLAGS = -I/usr/include/python2.7
CFLAGS =
CXXFLAGS =
LDFLAGS =
#Do not change anything beyond this point
CXXFLAGS += -std=c++11
@sfan5
sfan5 / cpbitmap2image.py
Created Jan 6, 2014
Tools to work with .cpbitmap files
View cpbitmap2image.py
#!/usr/bin/env python2
from PIL import Image
import sys
import struct
def r8(f):
return ord(f.read(1))
if len(sys.argv) <= 2:
print("Usage: %s <input> <output>" % sys.argv[0])
@sfan5
sfan5 / ffbuild.sh
Last active Nov 28, 2018
Builds ffmpeg with many libraries; easily configurable; can build mpv too
View ffbuild.sh
#!/bin/bash
set -e
ffbuild_conf=~/.config/ffbuild.conf
if [ ! -f $ffbuild_conf ]; then
mkdir -p $(dirname "$ffbuild_conf")
cat <<MEOW >"$ffbuild_conf"
#!/bin/bash
# This file contains settings for the ffbuild.sh build script
@sfan5
sfan5 / imgbump.py
Created Feb 15, 2014
Adds a bumpmap-like effect to images (works best on low-res [~16x16] textures).
View imgbump.py
#!/usr/bin/env python
import sys
from PIL import Image
FCT = 8
def diff2(a, b):
return abs(a-b)
def avg3(a, b, c, d=0):
@sfan5
sfan5 / gen_ean8.py
Created Mar 12, 2014
Generates an image with an EAN-8 barcode
View gen_ean8.py
#!/usr/bin/env python
from PIL import Image
import sys
l_code = {
0: '0001101',
1: '0011001',
2: '0010011',
3: '0111101',
4: '0100011',
@sfan5
sfan5 / packetgen.cpp
Last active Aug 29, 2015
does stuff using C++
View packetgen.cpp
#include <iostream>
#include <fstream>
#include <sstream>
#include <map>
#include <list>
#include <utility>
#include <stdlib.h> // for exit()
#include <vector>
template <typename T, typename U> class create_map {
@sfan5
sfan5 / controlfilegen.html
Last active Jan 18, 2018
Various tools for managing Cydia repositories & packages
View controlfilegen.html
<!DOCTYPE HTML>
<html>
<head>
<title>Cydia package control file Generator</title>
<style type="text/css">
* {
font-family: sans-serif;
}
input {
border-radius: 6px;
@sfan5
sfan5 / run-as.c
Last active Aug 29, 2015
A simple Android run-as replacement when the preinstalled one won't work (I'm looking at you Android 4.2)
View run-as.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include <stdarg.h>
#include <stdbool.h>
// Link this with a libselinux.so from your Android device
You can’t perform that action at this time.