Skip to content

Instantly share code, notes, and snippets.

@isayme
isayme / linux_affinity.c
Created December 6, 2012 05:52
利用linux线程亲和性绑定,使所有的core(指逻辑核而不是物理核)满负荷运行
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <sched.h>
#include <pthread.h>
void test_proc(void *arg)
@isayme
isayme / isayme.xcs
Last active March 7, 2022 12:52
xshell color scheme
[isayme]
text(bold)=eaeaea
magenta(bold)=ff00ff
text=ffffff
white(bold)=eaeaea
green=00c000
red(bold)=d20000
green(bold)=00ff00
black(bold)=808080
red=c00000
@isayme
isayme / cappkt.c
Created December 21, 2012 02:49
use libpcap to capture pkts in linux. Add filter 'tcp or udp'. gcc -g -o cappkt cappkt.c -lpcap
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <netinet/in.h>
#include <pcap/pcap.h>
// thread unsafe
void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data)
{
struct tm *ltime;
@isayme
isayme / bash
Last active December 10, 2015 22:28
Linux setting
export PS1='\[\e[36;1m\]\u\[\e[01;30m\]@\[\e[32;1m\]\h:\[\e[01;35m\]\w \$ \[\e[0m\]'
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'
@isayme
isayme / v2ex_coin.py
Last active July 3, 2020 07:59
V2EX 每日登陆奖励自动获取脚本. 此脚本不再更新, 毕竟要依赖第三方pycurl库. 新版见: https://github.com/isayme/v2ex
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 此脚本不再更新, 毕竟要依赖第三方pycurl库.
# 重写的脚本不再依赖非标准库, 感兴趣的见: https://github.com/isayme/v2ex
import sys
import string
try:
import pycurl2 as pycurl
@isayme
isayme / ascii_isayme.txt
Created September 22, 2013 14:41
ASCII for iSayme
** ********
// **////// ** **
** /** ****** //** ** ********** *****
/** /********* //////** //*** //**//**//** **///**
/** ////////** ******* /** /** /** /** /*******
/** /** **////** ** /** /** /** /**////
/** ******** //******** ** *** /** /** //******
// //////// //////// // /// // // //////
@isayme
isayme / id_chk.py
Created February 5, 2014 03:45
id check python script,
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re;
# id check function
def IC_chk(ic_serial):
# value array
iW = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1];
# characters in ID
@isayme
isayme / inotify.c
Last active August 29, 2015 13:57
donot touch my files if you are not root!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/select.h>
// 典型自执行函数格式:
// (funtion(root, factory) {
// // do stuff here
// })(this, factoryFunc);
// 其中`root`就是`this`, `factory`就是`factoryFunc`;
// 而`this`又根据环境的不同而不同, 具体见下面的注释.
(function(root, factory) {
// Set up Backbone appropriately for the environment. Start with AMD.
// 如果是AMD的模块规范(require.js使用的规范, 主要用于浏览器端).
body {
background: url(/img/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}