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
hex_table = { | |
0: "0", | |
1: "1", | |
2: "2", | |
3: "3", | |
4: "4", | |
5: "5", | |
6: "6", | |
7: "7", |
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 | |
#chmod +x daemon.py | |
#complete -cf daemon.py | |
import sys | |
import os | |
if len(sys.argv) < 2: | |
print "daemon.py cmdline..." | |
exit(0) |
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
import socket | |
import cStringIO | |
import struct | |
def parse_struct(b, fmt): | |
d = {} | |
fmts = "".join([x[1] for x in fmt]) | |
raw = b.read(struct.calcsize(fmts)) | |
raw = struct.unpack(fmts, raw) | |
for i, item in enumerate(fmt): |
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
import gdb | |
import os | |
log = "/tmp/gdb.out" | |
pid = int(open("/tmp/gdb.in", "r").read()) | |
gdb.execute("attach %d" % pid) | |
logfile = open(log, "w+", buffering=0) | |
p = gdb.selected_inferior() | |
of = "{:<5}{:<10}{:<5}\n" |
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
#include <fcntl.h> | |
#include <sys/types.h> | |
#include <time.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <signal.h> | |
char *lock_path = NULL; |
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
#-*-encoding=utf-8-*- | |
import sys | |
import pdb | |
#https://github.com/maliubiao/simple_http | |
import simple_http | |
from lxml import etree | |
xpath = "/html/body/div[3]/div[2]/div[4]/div[2]/ul/li/h6/a" | |
#锵锵三人行 |
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 os | |
import os.path | |
import stat | |
import sys | |
def new_queue(): | |
#the dummy head | |
h = { | |
"item": None, |
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
#-*-encoding=utf-8-*- | |
import gdb | |
import os | |
import pdb | |
import os.path | |
S_IRUSR = 0400 | |
S_IWUSR = 0200 | |
S_IXUSR = 0100 |
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
def flatten1(l): | |
s = [(l, 0)] | |
x = [] | |
while s: | |
d, i = s.pop() | |
dlen = len(d) | |
while i < dlen: | |
if isinstance(d[i], list): | |
s.append((d, i+1)) | |
s.append((d[i], 0)) |
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
import os | |
import string | |
letters = string.letters | |
lowercase = string.lowercase | |
uppercase = string.uppercase | |
digits = string.digits | |
punctuation = string.punctuation | |
all_nospace = digits + letters + punctuation |