Skip to content

Instantly share code, notes, and snippets.

View edwardbadboy's full-sized avatar

Zhengsheng Zhou edwardbadboy

  • VMware
  • Beijing, China
View GitHub Profile
@edwardbadboy
edwardbadboy / mboxclean.py
Created September 4, 2014 09:27
Ginger Scripts
#!/usr/bin/python
import os
import mailbox
import sys
def get_plaintext_messages(mbox):
r = []
for msg in mbox.values():

#The Great Firewall (GFW) Contributors List

注:数据来源为 dblp 和 cndblp, 下面括号中的数字表示 dblp 中显示的跟方滨兴合作论文的数量

###Binxing Fang (方滨兴)

中国工程院院士,北京邮电大学教授,中国科学院计算技术研究所网络方向首席科学家
http://en.wikipedia.org/wiki/Fang_Binxing

@edwardbadboy
edwardbadboy / signalfdReaperDemo.py
Created January 29, 2013 03:20
Useful Python code snippet.
from operator import itemgetter
import multiprocessing
import os
import signal
# yum install python-signalfd
import signalfd
import struct
import threading
import time
@edwardbadboy
edwardbadboy / log_settings.py
Created December 3, 2012 02:44 — forked from manfre/log_settings.py
Django logging filter to throttle repeated messages
# Example logging configuration that will restrict console logging to
# at most 2 repeated messages per 30 seconds.
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'simple': {
'format': '%(asctime)s - %(name)s - %(levelname)s - %(filename)s:%(lineno)d - %(message)s'
},
},
@edwardbadboy
edwardbadboy / addMethod.py
Created May 20, 2012 10:19
useful Python code
import types
def foo(self, b):
print self._a
print b
class X(object):
def __init__(self):
self._a = 10
@edwardbadboy
edwardbadboy / awklib.awk
Created March 23, 2012 06:14
useful awk functions
function qsort(A, left, right, i, last) {
if (left >= right)
return
last = left
for (i = left+1; i <= right; i++)
if (A[i] < A[left])
swap(A, ++last, i)
swap(A, left, last)
qsort(A, left, last-1)
qsort(A, last+1, right)
@edwardbadboy
edwardbadboy / combination.c
Created March 16, 2012 09:47
none recursive combination generation
//回溯法求组合C(n,k),visit是函数指针,每求出一个组合,就调用一次visit,你可以自己定义一个符合visit签名的函数,并在里面执行需要的动作,然后把地址传给combination
int combination(int n,int k,void (*visit)(int* ,int)){
int* d=(int*)malloc(sizeof(int)*k); //一共要选k个东西,就要选k次,d[i]表示选第i次的时候,选的是第几个东西
int count=0;
int i;
if(d==NULL){
return 0;
}
i=0;
d[i]=0;
@edwardbadboy
edwardbadboy / full-nelson.c
Created March 7, 2012 02:24
Linux Kernel <= 2.6.37 local privilege escalation
/*
* Linux Kernel <= 2.6.37 local privilege escalation
* by Dan Rosenberg
* @djrbliss on twitter
*
* Usage:
* gcc full-nelson.c -o full-nelson
* ./full-nelson
*
* This exploit leverages three vulnerabilities to get root, all of which were