Skip to content

Instantly share code, notes, and snippets.

View flyfire's full-sized avatar
🎯
Focusing

flyfire flyfire

🎯
Focusing
View GitHub Profile

This is a brief introduction about how Linux kernel handles the send system call.

This study is based on kernel version 3.7.2, which is the latest stable kernel when writing this study.

How system call is defined

In the latest kernel, the system call is defined using the SYSCALL_DEFINEx macro, in which x is the number of arguments. For example, in order to find the definition of asmlinkage long sys_sendto(int, void __user *, size_t, unsigned, struct sockaddr __user *, int);, you need to grep for SYSCALL_DEFINE6 because it has 6 arguments.

The definition of the system call send can be found at net/socket.c.

[Solarized Dark]
text(bold)=839496
magenta(bold)=6c71c4
text=839496
white(bold)=fdf6e3
green=859900
red(bold)=cb4b16
green(bold)=586e75
black(bold)=073642
red=dc322f
@flyfire
flyfire / isayme.xcs
Created December 11, 2013 07:03 — forked from isayme/isayme.xcs
[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
@flyfire
flyfire / isayme.xcs
Created December 11, 2013 07:06 — forked from isayme/isayme.xcs
[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
import requests
import datetime
from BeautifulSoup import BeautifulSoup
import random
import time
def get_page(url):
r=requests.get(url)
print url
return BeautifulSoup(r.text)
.
./collections.txt
./kindle
./kindle/documents
./kindle/documents/harry_potter_en
./kindle/documents/harry_potter_en/Harry_Potter_and_the_Chamber_of_Secrets_英文版mobi_4eb7f390.mobi
./kindle/documents/harry_potter_en/Harry_Potter_and_the_Deathly_Hallows__英文版mobi_4eb7f36a-1.mobi
./kindle/documents/harry_potter_en/Harry_Potter_and_the_Deathly_Hallows__英文版mobi_4eb7f36a.mobi
./kindle/documents/harry_potter_en/Harry_Potter_and_the_Goblet_Of_Fire_英文版mobi_4eb7f31b.mobi
./kindle/documents/harry_potter_en/Harry_Potter_and_the_Half-Blood_Prince_英文版mobi_4eb7f43d.mobi
@flyfire
flyfire / README.md
Created January 9, 2014 01:23 — forked from oklai/README.md

TCTicketScript

TCTicketScript是一段浏览器脚本,帮你自动查询火车票余票。

如何使用

  1. 进入https://dynamic.12306.cn/otsweb/,注意必须从这个地址进入,忽略警告信息;
  2. 在页面设定好你的出发地、目的地与出发日期;
  3. 复制TCTicketScript.js中的代码;
  4. 打开浏览器调试工具控制台(F12),执行此代码。第一次会询问是否开启桌面提示功能,需同意。

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...

# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import requests
username = '' ###账号###
password = '' ###密码###
login_url = 'http://v2ex.com/signin' ###如V2EX设置了使用 SSL,必须改 https###
index_url = 'http://v2ex.com' ###同上###
mission_url = 'http://www.v2ex.com/mission/daily' ###同上###
UA = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) \
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from pyquery import PyQuery as pq
class V2User(object):
def __init__(self, username, password):
self.username = username
self.password = password