- NodeBox - a nice lib to create images of graph networks
- Python Image Library
- BeautfulSoup - HTML parser
- mechanize - automated web browsing
| # A fixed @jsonify decorator for Pylons that allows for | |
| # class implemented __json__ serializers | |
| from decorator import decorator | |
| from pylons.decorators.util import get_pylons | |
| import warnings | |
| import json | |
| import logging | |
| log = logging.getLogger(__name__) |
| 王 | |
| 江 | |
| 周 | |
| 胡 | |
| 刘 | |
| 李 | |
| 吴 | |
| 毛 | |
| 温 | |
| 习 |
| # A naive dns server with a Redis backend | |
| # Set keys in Redis you want to be authoritative for (set google.com. 127.0.0.1) | |
| # Tip: Use Redis's ttl functions to have temporary names | |
| # Currently only does A records, feel free to fix that | |
| # | |
| # Licensed under the PSF License | |
| # Thanks to: http://code.activestate.com/recipes/491264-mini-fake-dns-server/ | |
| # Author: @Kaerast <[email protected]> | |
| import socket |
| ! colours for hybrid.vim (copied from Tomorrow-Night) | |
| #define t_background #1d1f21 | |
| #define t_current_line #282a2e | |
| #define t_selection #373b41 | |
| #define t_foreground #c5c8c6 | |
| #define t_comment #969896 | |
| #define t_red #cc6666 | |
| #define t_orange #de935f | |
| #define t_yellow #f0c674 | |
| #define t_green #b5bd68 |
| import simplejson as json | |
| import lxml | |
| class objectJSONEncoder(json.JSONEncoder): | |
| """A specialized JSON encoder that can handle simple lxml objectify types | |
| >>> from lxml import objectify | |
| >>> obj = objectify.fromstring("<Book><price>1.50</price><author>W. Shakespeare</author></Book>") | |
| >>> objectJSONEncoder().encode(obj) | |
| '{"price": 1.5, "author": "W. Shakespeare"}' | |
| """ |
Based on installing Ubuntu 10.04 (lucid) and cloning the live environment (calling local environment dev.jsbin.com)
Add core packages:
sudo apt-get install libpcre3-dev build-essential libssl-dev
sudo apt-get install git-core
sudo su -
mkdir pkgs && cd pkgs
wget http://nginx.org/download/nginx-1.0.0.tar.gz
| """SSL client/server certificates verification for `urllib2`. | |
| It works on Python 2.6, 2.7, 3.1, 3.2 | |
| It also works on Python 2.4, 2.5 if `ssl` is installed (``pip install ssl``) | |
| Example:: | |
| >>> import urllib2, urllib2_ssl | |
| >>> opener = urllib2.build_opener(urllib2_ssl.HTTPSHandler( | |
| ... key_file='clientkey.pem', |
| import os | |
| import re | |
| import socket | |
| import struct | |
| def dns_resolve(host, dnsserver): | |
| assert isinstance(host, basestring) and isinstance(dnsserver, basestring) | |
| index = os.urandom(2) | |
| hoststr = ''.join(chr(len(x))+x for x in host.split('.')) | |
| data = '%s\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00%s\x00\x00\x01\x00\x01' % (index, hoststr) |