Skip to content

Instantly share code, notes, and snippets.

View deadbits's full-sized avatar
🪴

Adam Swanda deadbits

🪴
View GitHub Profile
# -*- encoding: UTF-8 -*-
#
# sample django HTTP proxy
#
import urlparse
import requests
import logger
@deadbits
deadbits / proxy_wrap.py
Created April 21, 2013 05:53
simple class wrapper for python proxy functions. relies on the socks.py module
#!/usr/bin/env python
##
# class wrapper for proxy configurations
# original code by fitblip (http://www.talesofacoldadmin.com/)
# - added tor newnym
# - added get_ip
# - modified tor check function (requests instead of urllib and built-in function)
# - combined functions into class wrapper
# - more to come soon...
#
#
# One-liners (or one'ish-liners)
#
### CONVERT a hex file to hex string
# for_testing$ echo -n "DEADBEEFDEADBEEF" > tmp
File.open("tmp", "rb") {|f| [f.read].pack("H*")}
# => "\xDE\xAD\xBE\xEF\xDE\xAD\xBE\xEF"
### CONVERT to base64 (note .encode and .strict_encode can have different results)
#!/usr/bin/python
''' Not my script, found on the Internet, and rediscovered on my hard drive
'''
import sys
def cidr_to_regex(cidr):
ip, prefix = cidr.split('/')
base = 0
for val in map(int, ip.split('.')):
@deadbits
deadbits / docs.txt
Created February 16, 2015 21:13
documentation format
Functions and Methods (function or method docstrings)
@param p: ... A description of the parameter p for a function or method. It may appear in the class docstring to describe a costructor parameter: mostly useful for C extensions.
@type p: ... The expected type for the parameter. p.
@return: ... The return value for a function or method.
@rtype: ... The type of the return value for a function or method.
@keyword p: ... A description of the keyword parameter p. It may appear in the class docstring to describe a costructor keyword parameter.
@raise e: ... A description of the circumstances under which a function or method raises exception e. It may appear in the class docstring to describe an exception that can be raised by the costructor.
Variables (module, class or variable docstrings)
@deadbits
deadbits / hashdeep.py
Last active August 29, 2015 14:16 — forked from techtonik/hashdeep.py
"""
Build recursive hash of files in directory tree in hashdeep format.
Hashdeep format description:
http://md5deep.sourceforge.net/start-hashdeep.html
hashdeep.py differences from original hashdeep:
- if called without arguments, automatically starts to build
@deadbits
deadbits / keybase.md
Created September 23, 2015 20:39
keybase.md

Keybase proof

I hereby claim:

  • I am deadbits on github.
  • I am deadbits (https://keybase.io/deadbits) on keybase.
  • I have a public key whose fingerprint is D65D 4712 2018 9C21 E5D2 13B5 D65E F900 37DD 79AF

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am deadbits on github.
* I am deadbits (https://keybase.io/deadbits) on keybase.
* I have a public key whose fingerprint is 01ED C31F 32E4 5485 EF76 9E25 A88F 2B93 A135 1871
To claim this, I am signing this object:
@deadbits
deadbits / file
Created October 12, 2016 20:42
freedom_public
{"0.8860596202739888":"-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nCharset: UTF-8\r\n\r\nxv8AAABSBAAAAAATCCqGSM49AwEHAgMEU5ZmbeeUKwyOJ3v5azKjP4O5CS41Pn1x\r\nTfqHHZ/v9lp8QfZu6HoTajhoEDoVIqXNB3EJh+Cu1wwGTr2d+FZCfM3/AAAACDxn\r\naXRodWI+wv8AAACOBBATCABA/wAAAAWCV/6gRv8AAAACiwn/AAAACZC7gUej3gND\r\nS/8AAAAFlQgJCgv/AAAABJYDAQL/AAAAApsD/wAAAAKeAQAAmR4A/1/uFhVw6uQp\r\ntSIcAeboRx096B8f3d9AdgFIwKZsoflTAQCSl1GogGRTEHvhcNFIvv7GcG/9wYs4\r\n3g1DfC1TiITlxs7/AAAAVgQAAAAAEggqhkjOPQMBBwIDBEvpEO0sZG0gtUvUVmIM\r\n88oHsfafZBjnsiAgbAqhliVqfFGS0kxcq+y6HaIIezwv/01ztwILHsxZlS2hfEWL\r\n1TEDAQgHwv8AAABtBBgTCAAf/wAAAAWCV/6gRv8AAAAJkLuBR6PeA0NL/wAAAAKb\r\nDAAAT1sBAIYloqmelecTEbeAITM2zLBMkEOc6gdsb+mQjaqfLtyaAQCMgIZhsBob\r\nLWTPkNrbsIVlUZ7LrIiOSh3S1sm2yYYnKg==\r\n=5tLS\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n"}
Verifying that "amsdbs.id" is my Blockstack ID. https://onename.com/amsdbs