Skip to content

Instantly share code, notes, and snippets.

@ajgappmark
ajgappmark / util.py
Created June 22, 2017 09:28 — forked from shazow/util.py
Python utility functions I wrote and use often. See https://github.com/shazow/unstdlib.py for more.
"""
Handy Python functions written by Andrey Petrov (shazow). I release this code
under public domain. (Attribution is optional but appreciated.)
Approximate changelog (according to https://gist.github.com/603374):
2011-05-05
- I made a proper github repo out of this:
https://github.com/shazow/unstdlib.py
@ajgappmark
ajgappmark / gist:55662428bea4fb1928c294e61015d850
Created July 9, 2017 12:14 — forked from rriley/gist:ce38ab20532c1d7a2667
A script to use the Android ART compiler to generate x86 binaries from apk files. Tested with Android 5.1.1_r4
# How to use ART to compile arm oat files on the host:
# - Get source code according to https://source.android.com/source/downloading.html
# - source build/envsetup.sh
# - mm build-art
# - Use this script in the source root directory to compile APKs
CWD=`pwd`
export ANDROID_DATA="${CWD}/out/host/datadir/dalvik-cache/x86_64"
export ANDROID_ROOT="${CWD}/out/host/linux-x86"
BOOT_IMAGE="${CWD}/out/host/linux-x86/framework/core.art"
@ajgappmark
ajgappmark / art-compile-arm.sh
Created July 9, 2017 12:15 — forked from rriley/art-compile-arm.sh
A script to use the Android ART compiler to generate ARM binaries from apk files. Tested with Android 5.1.1_r4
# How to use ART to compile arm oat files on the host:
# - Get source code according to https://source.android.com/source/downloading.html
# - source build/envsetup.sh
# - mm build-art
# - Build the full android image for aosp_arm-eng
# (Follow the directions at https://source.android.com/source/building.html)
# - Use this script in the source root directory to compile APKs
CWD=`pwd`
export ANDROID_DATA="${CWD}/out/host/datadir/dalvik-cache/x86_64"
@ajgappmark
ajgappmark / VideoStream.php
Created July 9, 2017 13:29 — forked from ranacseruet/VideoStream.php
PHP VideoStream class for HTML5 video streaming
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
@ajgappmark
ajgappmark / fsec_solve.py
Created October 15, 2017 11:51 — forked from LiveOverflow/fsec_solve.py
Fsec2017 z3 solution
from z3 import *
import struct
# calculate e,f,d for a given input password
def calc(m):
e = 0
f = 0
d = 0
for i in xrange(0, len(m)):
c = ord(m[i])
@ajgappmark
ajgappmark / Makefile
Created November 8, 2017 10:25 — forked from maciejjo/Makefile
Generic Makefile for a small C project
SRCDIR = src
HDRDIR = headers
OBJDIR = obj
BINDIR = bin
DEPDIR = dep
DATDIR = data
CC = gcc
TARGET = sorting
CFLAGS = -Wall -Wextra -pedantic -g -O0 -I$(HDRDIR)
@ajgappmark
ajgappmark / remcomms.sh
Created February 16, 2018 12:28 — forked from mystix/remcomms.sh
Script to strip all C comments
# Strip C comments
# by Stewart Ravenhall <stewart.ravenhall@ukonline.co.uk> -- 4 October 2000
# Un-Korn-ized by Paolo Bonzini <bonzini@gnu.org> -- 24 November 2000
# Strip everything between /* and */ inclusive
# Copes with multi-line comments,
# disassociated end comment symbols,
# disassociated start comment symbols,
# multiple comments per line
@ajgappmark
ajgappmark / pi_mp.py
Created February 18, 2018 20:20 — forked from amitsaha/pi_mp.py
Parallel Pi Calculation using Python's multiprocessing module
''' listing 6: pi_mp.py
Multiprocessing based code to estimate the value of PI
using monte carlo sampling
Ref: http://math.fullerton.edu/mathews/n2003/montecarlopimod.html
Uses workers:
http://docs.python.org/library/multiprocessing.html#module-multiprocessing.pool
'''
import random
@ajgappmark
ajgappmark / server.py
Created March 25, 2018 07:23 — forked from umbrant/server.py
Simple multi-threaded python server that offers up a file with a delay per line
import socket
import time
import threading
import SocketServer
class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
def handle(self):
data = open("file", "r").readlines()
for line in data:
@ajgappmark
ajgappmark / git-commit-log-stats.md
Created April 12, 2018 11:13 — forked from eyecatchup/git-commit-log-stats.md
Some commands to get git commit log statistics for a repository on the command line.

git commit stats

Commands to get commit statistics for a Git repository from the command line -
using git log, git shortlog and friends.