Skip to content

Instantly share code, notes, and snippets.

@allanlw
allanlw / Dockerfile
Created November 21, 2014 21:04
BAP 0.8 Dockerfile for ubuntu 12.04
FROM ubuntu:12.04
RUN apt-get update && apt-get -y --no-install-recommends install \
automake \
binutils-dev \
bison \
build-essential \
ca-certificates \
camlidl \
camlp4-extra \
@allanlw
allanlw / rc4.cpp
Created December 14, 2014 05:59
RC4 PRNG unrolled with C++ templates
#include <cstdint>
#include <cstddef>
#include <cstdio>
#include <cstring>
struct RC4State {
uint8_t i, j;
uint8_t S[256];
RC4State(uint8_t *key, size_t key_len) : i(0), j(0) {
@allanlw
allanlw / triage.sh
Created January 22, 2015 19:06
Triage
#!/bin/bash
# Force libc to output fatal errors to stderr instead of
# writing to the terminal directly
export LIBC_FATAL_STDERR_=1
# Should be set as the path to the exploitable binary
EXPLOITABLE=~/exploitable/exploitable/exploitable/exploitable.py
# Ghetto script so -d has to be first
@allanlw
allanlw / aos.sh
Created February 22, 2015 17:20
build and run an android aos automagically on Ubuntu 14.04
#!/bin/bash
# Configurable options
REPO_TAG=android-4.4.3_r1.1
LUNCH_TARGET=aosp_arm-eng
CCACHE_SIZE=10G
WORKDIR=aos_workdir
# Below this is just all the script crap
set -e # abort after first error
@allanlw
allanlw / cut_gimp.py
Created June 4, 2016 14:11
Gimp Magicwand cut script
# This file contains a function for cutting a subject out of an image.
# Right now it just uses the top left corner, and gimp's magic wand. Could do something.
import gimpfu
import os
# if debug==True, we place on a green background
def convert(filename, new_name, debug=False):
img = pdb.gimp_file_load(filename, filename)
layer = pdb.gimp_image_merge_visible_layers(img, 1)
@allanlw
allanlw / blender_obj_to_blend_flipped_v.py
Created September 11, 2016 00:28
A blender script to flip import an obj with borked UVs!
# invoke like blender --background --python belnder_obj_to_blend_flipped_v.py -- input.obj output.blend
import bpy
import sys
argv = sys.argv
argv = argv[argv.index("--") + 1:] # get all args after "--"
obj_out = argv[0]
@allanlw
allanlw / index.html
Created January 21, 2017 01:10
Human Sort
<!DOCTYPE html>
<!--
This is a simple script to manually heap sort images.
It loads images from a relative file filelist.txt, which is a list of image (really page) URIs
separate by new lines.
It will prompt the user for comparisons. Press the A key for left image or F key for the right image.
When it's done it logs to console.log.
@allanlw
allanlw / Dockerfile
Created January 6, 2017 15:34
Secretgrind Dockerfile
FROM ubuntu:14.04
# Ubuntu 14.04 is used instead of 16.04, because 16.04 has too new a version of GCC
# and valgrind configure complains
# automake is needed for aclocal to build the valgrind code
# wget and git for fetching source
# python is required for building capstone
RUN apt-get update && apt-get -y install \
build-essential \
@allanlw
allanlw / solver.py
Created February 27, 2017 02:13
combined.space solution
#!/usr/bin/python
import urllib2
import string
import random
import urllib
import cgi
l = list(string.ascii_letters)
random.shuffle(l)
@allanlw
allanlw / anki_dupes.py
Created July 11, 2017 01:46
anki-dupes
# Quick script for finding cards that are dupes based on the sort field
from collections import defaultdict
q = defaultdict(list)
for (k,v) in [ (anki.utils.stripHTML(y.fields[y.col.models.sortIdx(y._model)]), y) for y in [mw.col.getNote(x) for x in mw.col.findNotes("deck:Japanese")]]:
q[k].append(v)
dupes = [(k,v) for (k,v) in q.items() if len(v) > 1]
for k,vs in dupes:
for b in vs:
b.addTag("allandup")
b.flush()