Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am perks on github.
* I am perks (https://keybase.io/perks) on keybase.
* I have a public key ASCvQmDWdl8ZOgxJHysgGmOZLnXn_x3qsjlMTkzcHaGwGQo
To claim this, I am signing this object:
@perks
perks / git-mv-with-history
Created March 1, 2016 21:20 — forked from emiller/git-mv-with-history
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@perks
perks / keybase.md
Last active April 12, 2018 16:09
Keybase Proof

Keybase proof

I hereby claim:

  • I am perks on github.
  • I am perks (https://keybase.io/perks) on keybase.
  • I have a public key ASCvQmDWdl8ZOgxJHysgGmOZLnXn_x3qsjlMTkzcHaGwGQo

To claim this, I am signing this object:

from M2Crypto import BIO, RSA
import base64
def der_length(length):
"""DER encoding of a length"""
if length < 128:
return chr(length)
prefix = 0x80
result = ''
while length > 0:
@perks
perks / getenvaddr.c
Created July 2, 2015 15:53
getenvaddr.c - find environment variable addresses
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]) {
char *ptr;
if(argc < 3) {
printf("Usage: %s <environment variable> <target program name>\n", argv[0]);
exit(0);
"\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x89\xc2\xb0\x0b\xcd\x80"
#!/bin/bash -e
# This script is for controlling OSX v5.7.4 tftpserver
case "$1" in
'start')
launchctl load -F /System/Library/LaunchDaemons/tftp.plist
launchctl start com.apple.tftpd
echo "tftpserver started..."
@perks
perks / oui.txt
Created June 12, 2014 01:07
MAC prefix
00:00:00
00:00:01
00:00:02
00:00:03
00:00:04
00:00:05
00:00:06
00:00:07
00:00:08
00:00:09
@perks
perks / mac_shuffle.sh
Created June 12, 2014 01:05
Randomize Mac Address if not connected to Wi-Fi (OSX)
#!/bin/bash
INTERFACE=en0
OUI="/opt/local/etc/oui.txt"
OUI_LEN=19004
while [ true ]; do
STATUS=`ifconfig ${INTERFACE} | grep status: | awk '{print $2}'`
if [ "$STATUS" = "inactive" ]; then
R=$(((RANDOM % ${OUI_LEN})+1))