This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DictDiffer(object): | |
""" | |
Calculate the difference between two dictionaries as: | |
(1) items added | |
(2) items removed | |
(3) keys same in both but changed values | |
(4) keys same in both and unchanged values | |
http://code.activestate.com/recipes/576644-diff-two-dictionaries/#c7 | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IPy==0.81 | |
dpkt==1.8.6 | |
pycrypto==2.6.1 | |
pygeoip==0.3.2 | |
pypcap==1.1.1 | |
wsgiref==0.1.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql_install_db --verbose --user=$USER --basedir=/usr/local/Cellar/mysql/5.X --datadir="/NEW/PATH/" --tmpdir=/tmp | |
cd /usr/local/Cellar/mysql/5.X/bin/ | |
vim mysql.server # change datadir | |
mysql.server start | |
/usr/local/Cellar/mysql/5.X/bin/mysqladmin -u root password 'ROOTPASSWORD' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> my_dict = {'one': 1, 'two': 2, 'a_tuple': ('1', '2', '3')} | |
>>> my_dict.__hash__ is None | |
True | |
>>> frozenset(my_dict.items()) | |
frozenset({('a_tuple', ('1', '2', '3')), ('one', 1), ('two', 2)}) | |
>>> hash(frozenset(my_dict.items())) | |
-8556322717805028753 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''cjson, jsonlib, simplejson, and yajl also use C code | |
demjson did not use C code, but was too painfully slow to benchmark | |
(took about 20 seconds for these tests) | |
''' | |
import json | |
import sys | |
import time | |
with open('doc.json') as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://sickbits.net/other/pcapworksheet.txt | |
1.) OS Stats | |
$ ifconfig eth0; ifconfig -a | |
$ netstat -ni | |
$ netstat -s | |
$ cat /proc/net/dev | columns -t | |
$ awk '{ print $1,$5 }' /proc/net/dev | |
$ watch -n 1 cat /proc/interrupts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir my_project | |
cd my_project | |
echo " . . . Downloading file stanford-ner-2014-08-27.zip" | |
# NOTE: need to update link for further versions | |
wget http://nlp.stanford.edu/software/stanford-ner-2014-08-27.zip | |
echo " . . . Unpacking stanford-ner-2014-08-27.zip" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import getopt, sys, re, urllib2, urllib, BaseHTTPServer | |
from urllib2 import Request, urlopen, URLError, HTTPError | |
################## HEADER ################################### | |
# | |
# Traceroute-like HTTP scanner | |
# Using the "Max-Forwards" header |
OlderNewer