Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import logging
from scapy.all import *
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
fakeip = ["4.36.66.178", "8.7.198.45", "37.61.54.158", "46.82.174.68", "59.24.3.173", "64.33.88.161", "64.33.99.47", "64.66.163.251", "65.104.202.252", "65.160.219.113", "66.45.252.237", "72.14.205.104", "72.14.205.99", "78.16.49.15", "93.46.8.89", "128.121.126.139", "159.106.121.75", "169.132.13.103", "192.67.198.6", "202.106.1.2", "202.181.7.85", "203.161.230.171", "207.12.88.98", "208.56.31.43", "209.145.54.50", "209.220.30.174", "209.36.73.33", "211.94.66.147", "213.169.251.35", "216.221.188.182", "216.234.179.13"]
testdomain = ["twitter.com", "facebook.com", "youtube.com"]
dnshost = "8.8.8.8"
for h in testdomain:
var crypto = require('crypto');
var SaltLength = 9;
function createHash(password) {
var salt = generateSalt(SaltLength);
var hash = md5(password + salt);
return salt + hash;
}
description "PostgreSQL 9.1 Server"
author "PostgreSQL"
start on runlevel [2345]
stop on runlevel [016]
expect fork
respawn
env POSTGRESQL_HOME="/var/lib/postgresql/9.1/main"
{
"name": "my-app",
"version": "0.0.0",
"dependencies": {
"browserify": "~2.36.1",
"less": "~1.5.1"
},
"devDependencies": {
"watchify": "~0.4.1",
"catw": "~0.2.0"
# /etc/security/limits.conf
* soft nofile 999999
* hard nofile 999999
root soft nofile 999999
root hard nofile 999999
===========================================================
# /etc/sysctl.conf
# sysctl for maximum tuning
import email
def get_decoded_email_body(message_body):
""" Decode email body.
Detect character set if the header is not set.
We try to get text/plain, but if there is not one then fallback to text/html.
:param message_body: Raw 7-bit message body input e.g. from imaplib. Double encoded in quoted-printable and latin-1

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@zhangw
zhangw / github-host
Last active August 29, 2015 14:26 — forked from Jayin/github-host
Github最近访问不了,hosts加入以下两行解决:
Github最近访问不了,hosts加入以下两行解决:
185.31.17.184 github.global.ssl.fastly.net
185.31.17.184 github-camo.global.ssl.fastly.net
@zhangw
zhangw / gb2312-utf8-convert.js
Created December 12, 2015 17:36 — forked from fwolf/gb2312-utf8-convert.js
Convert between gb2312 and utf8 using javascript
http://freecode-freecode.blogspot.com/2008/11/how-to-gbkgb2312-and-utf-8-encoding.html
GB2312UTF8 = {
Dig2Dec : function(s){
var retV = 0;
if(s.length == 4){
for(var i = 0; i < 4; i ++){
retV += eval(s.charAt(i)) * Math.pow(2, 3 - i);
}
return retV;
@zhangw
zhangw / program.rb
Created March 7, 2016 16:19 — forked from CaroleD/program.rb
Ruby
puts "hello"
p "hello"
my_name = "Carole"
def salut(name)
p "hello" + " " + name
end
salut(my_name)
def greeting
puts "Enter your name : "
name = gets.chomp