Skip to content

Instantly share code, notes, and snippets.

View staticshock's full-sized avatar
🐜
ants, everywhere

Anton Backer staticshock

🐜
ants, everywhere
View GitHub Profile

Keybase proof

I hereby claim:

  • I am staticshock on github.
  • I am staticshock (https://keybase.io/staticshock) on keybase.
  • I have a public key ASCzeVOQmPwSMgB0X2GvzwVqPKvto2Nj-eUOleg32kb4Pgo

To claim this, I am signing this object:

@staticshock
staticshock / mbox_to_csv.py
Last active September 19, 2018 23:55
Convert mbox data to csv data
import csv
import mailbox
import email.header
import sys
import bs4
import re
from dateutil.parser import parse as parse_date
def run(mbox_path):
@staticshock
staticshock / gist:81ee72dfc2bed85613eb
Last active August 29, 2015 14:21
Roman numerals in python
#!/usr/bin/env python
# 100 = C = 100
# 200 = CC = 100 + 100
# 300 = CCC = 100 + 100 + 100
# 400 = CD = -100 + 500
# 500 = D = 500
# 600 = DC = 500 + 100
# 700 = DCC = 500 + 100 + 100
# 800 = DCCC = 500 + 100 + 100 + 100
@staticshock
staticshock / gist:b6d5e62f353d9b40c0a6
Last active August 29, 2015 14:12
Map <leader>[a-zA-Z] to show an error, unless already mapped
for ch in split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', '\zs')
if mapcheck('<leader>' . ch, 'n') == ""
execute 'nnoremap <leader>' . ch . ' :echoerr "Unassigned mapping"<cr>'
endif
endfor
@staticshock
staticshock / bookmarklets.js
Last active January 3, 2016 19:59
UCTF bookmarklets
// Bind F7 to 'step'
javascript:$(document).bind('keydown', function(e) { e.which == 118 && parse('s'); }); void(0)
// Add a 'readhex' command that works just like 'read' but dumps nothing but the hex
javascript:cpu._readhex =
function(e) {
if (!e[1]) return write(" Please give an expression to read the memory at."), void 0;
var t = cpu.to_addr(e[1]);
cpu.get("/cpu/dbg/memory/" + t + "?len=" + (parseInt(e[2], 16) + (15 - parseInt(e[2], 16) & 15) || 32), function(e) {
for (var n = atob(e.raw), i = "", o = " ", s = 0; s < n.length; s++) s % 2 == 0 && (o += " "), o += pad(n.charCodeAt(s).toString(16), 2), s % 8 == 7 && (i += " " + o + "\n", o = " ");
@staticshock
staticshock / halloween.py
Created November 29, 2013 02:44
What day of week is Halloween?
#!/usr/bin/env python
from __future__ import print_function
import sys
from datetime import datetime
# Usage: ./halloween.py 100 10 31
start_year = datetime.now().year
end_year = start_year + int(sys.argv[1])
month = int(sys.argv[2])
day = int(sys.argv[3])
@staticshock
staticshock / .gitignore
Created September 13, 2012 12:43
Euler in Haskell
*.exe
*.hi
*.o
data Array a b = Array a b -- lengthType, entryType
instance (Show a, Show b) => Show (Array a b) where
show (Array lengthType entryType) = show lengthType ++ " * " ++ show entryType
#!/usr/bin/python
class Test(object):
def __init__(self, a):
self.a = a
def __eq__(self, other):
print "__eq__(%i, %i)" % (self.a, other.a)
return self.a == other.a
def __ne__(self, other):
print "__ne__(%i, %i)" % (self.a, other.a)