Skip to content

Instantly share code, notes, and snippets.

🐦
bird

Amber Brown hawkowl

🐦
bird
View GitHub Profile
View twistedDocSearch.py
# THIS IS A HAWKOWL SCRIPT
# HERE BE SPIDERS
# (C) HAWKOWL 2014, ORIGINAL CHARACT^W SCRIPT DO NOT STEAL
# (actually it's MIT)
# TO USE (you need a git repo):
# $ cd Twisted
# $ svn ls svn://svn.twistedmatrix.com/svn/Twisted/branches/ > branches.txt
# $ python twistedDocSearch.py branches.txt 2> /dev/null | sort | uniq > changedfiles.txt
View gist:9769031
[tox]
envlist = pypy-tw121-nopyopenssl, pypy-tw121-pyopenssl13, pypy-tw121-pyopenssl14, pypy-tw121-pyopenssltrunk, pypy-tw122-nopyopenssl, pypy-tw122-pyopenssl13, pypy-tw122-pyopenssl14, pypy-tw122-pyopenssltrunk, pypy-tw123-nopyopenssl, pypy-tw123-pyopenssl13, pypy-tw123-pyopenssl14, pypy-tw123-pyopenssltrunk, pypy-tw130-nopyopenssl, pypy-tw130-pyopenssl13, pypy-tw130-pyopenssl14, pypy-tw130-pyopenssltrunk, pypy-tw131-nopyopenssl, pypy-tw131-pyopenssl13, pypy-tw131-pyopenssl14, pypy-tw131-pyopenssltrunk, pypy-tw132-nopyopenssl, pypy-tw132-pyopenssl13, pypy-tw132-pyopenssl14, pypy-tw132-pyopenssltrunk, pypy-twtrunk-nopyopenssl, pypy-twtrunk-pyopenssl13, pypy-twtrunk-pyopenssl14, pypy-twtrunk-pyopenssltrunk, py27-tw121-nopyopenssl, py27-tw121-pyopenssl13, py27-tw121-pyopenssl14, py27-tw121-pyopenssltrunk, py27-tw122-nopyopenssl, py27-tw122-pyopenssl13, py27-tw122-pyopenssl14, py27-tw122-pyopenssltrunk, py27-tw123-nopyopenssl, py27-tw123-pyopenssl13, py27-tw123-pyopenssl14, py27-tw123-pyopenssltrunk, py27-tw13
View pypiproxy.py
from klein import Klein
from twisted.python.filepath import FilePath
import logging
import time
import treq
class pypiProxyService(object):
pypiURL = "https://pypi.python.org/simple/"
View gist:c0b39b94443584cfc94f
$ curl -X POST localhost:8020/v1/domains -d "domain=atleastfornow.net" \
-d "soa=hawkowl@atleastfornow.net"
-u user:password
{"status": "success", "data": {"soa": "hawkowl@atleastfornow.net", "default": "active", "domain": "atleastfornow.net", "axfr": [], "id": 3}}
$ curl -X POST localhost:8020/v1/domains/3/A -d "host="
-d "target=192.168.1.1"
-u user:password
{"status": "success", "data": {"host": "", "ttl": 86000, "id": 4, "target": "192.168.1.1"}}
$ curl -X POST localhost:8020/v1/domains/3/A -d "host=www"
-d "target=192.168.1.1"
View gist:5a9c4e74638b05b3a1d9
(require 'multiple-cursors)
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
View gist:c5c37c2b0318edcccb6c
from twisted.python.compat import networkFormat, networkString, nativeString
import timeit
# Mixed types
def mixed_format():
networkFormat("{0}:{1}:{2}", (b"foo", u"bar", "baz"))
def bytes_format():
networkFormat("{0}:{1}:{2}", (b"foo", b"bar", b"baz"))
View gist:37cb658649801309e00b
from twisted.python.compat import networkFormat, networkString, nativeString
import timeit
# Mixed types
def mixed_format():
networkFormat("{0}:{1}:{2}", (b"foo", u"bar", "baz"))
def bytes_format():
networkFormat("{0}:{1}:{2}", (b"foo", b"bar", b"baz"))
View gist:d1c7e13997fa6553efc4
import platform
p = platform.linux_distribution()
if p[0] == "debian" and float(p[1]) > 7:
print "New Debian"
else:
print "Old Debian"
View gist:5004980
red ~/code/bootstrap/ (master) $
npm install phantomjs
npm http GET https://registry.npmjs.org/phantomjs
npm http 200 https://registry.npmjs.org/phantomjs
npm http GET https://registry.npmjs.org/phantomjs/-/phantomjs-1.8.1-3.tgz
npm http 200 https://registry.npmjs.org/phantomjs/-/phantomjs-1.8.1-3.tgz
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/unzip
npm http 200 https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/rimraf/-/rimraf-2.0.3.tgz
View gist:62b38702073f6f9de7933d392712a605
red ~/test [127]> python3 -m virtualenv --clear test
Not deleting test/bin
Using base prefix '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5'
New python executable in test/bin/python3.5
Also creating executable in test/bin/python
Installing setuptools, pip, wheel...done.
red ~/test> python -m virtualenv --clear test
Not deleting /Users/red/test/test/bin
Using real prefix '/System/Library/Frameworks/Python.framework/Versions/2.7'
New python executable in /Users/red/test/test/bin/python
You can’t perform that action at this time.