Skip to content

Instantly share code, notes, and snippets.

View luftreich's full-sized avatar

luftreich

  • MXB.Ltd
  • Shenzhen.China
View GitHub Profile
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=JWR66N
ro.build.display.id=JWR66N
ro.build.version.incremental=711294
ro.build.version.sdk=18
ro.build.version.codename=REL
ro.build.version.release=4.3
ro.build.date=Sat Jun 15 19:53:50 UTC 2013
ro.build.date.utc=1371326030
@luftreich
luftreich / gist:fe33cf6dd9d5c5a10250
Last active January 29, 2017 08:59
gevent performance tuning
$ vi /etc/sysctl.conf
# 系统所有进程一共可以打开的文件数量, 每个套接字也占用一个文件描述字
fs.file-max = 1491124
# 系统同时保持TIME_WAIT套接字的最大数目,http 短链接会产生很多 TIME_WAIT 套接字。
net.ipv4.tcp_max_tw_buckets = 7000
# 关闭 tcp 来源跟踪
net.ipv4.conf.default.accept_source_route = 0
# 缩短套接字处于 TIME_WAIT 的时间, 60s -> 30s
net.ipv4.tcp_fin_timeout = 30
# 启用 TIME_WAIT 复用,使得结束 TIEM_WAIT 状态的套接字的端口可以立刻被其他套接字使用。
---- Dec 7, 2014 9:44:52 PM ----
12-07 21:44:54.733 475 507 I WindowManager: mapkey no map key list
12-07 21:44:54.893 475 507 I WindowManager: mapkey no map key list
12-07 21:44:56.793 116 348 I audio_hw_hdmi: [do_output_standby 733]Clear LastStream/0xb7f8cd78
12-07 21:44:56.793 116 348 I audio_hw_hdmi: [do_output_standby 738]pcm_opened/1

平台:DigitalOcean VPS ubuntu14.04 x64, strongswan5.2.2 运行以下命令请使用root权限

一:安装strongswan

由于ubuntu软件仓库中strongswan版本较低,因此从官网源码编译安装

apt-get install build-essential     #编译环境
aptitude install libgmp10 libgmp3-dev libssl-dev pkg-config libpcsclite-dev libpam0g-dev     #编译所需要的软件
// get screen layout long
int long = getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_LONG_MASK;
switch (long) {
case Configuration.SCREENLAYOUT_LONG_YES:
// Long screens, such as WQVGA, WVGA, FWVGA
break;
case Configuration.SCREENLAYOUT_LONG_NO:

dnsmasq的配置文件由/etc/config/dhcp决定 ####禁用 dnsmasq 的 DNS 功能 在该文件 config dnsmasq下添加

option port 54

如果你的 WAN 口是 PPPOE 等方式连接,而且系统日志中有 DHCP packet received on eth0.2 which has no address 就再添加

package main
import (
"database/sql"
"encoding/json"
"html/template"
"log"
"math/rand"
"net/http"
"runtime"
@luftreich
luftreich / _.md
Last active August 29, 2015 14:18 — forked from klange/_.md

Since this is on Hacker News and reddit...

  • No, I don't distribute my résumé like this. A friend of mine made a joke about me being the kind of person who would do this, so I did (the link on that page was added later). My actual résumé is written in BSD mandoc.
  • I apologize for the use of _t in my types. I spend a lot of time at a level where I can do that; "reserved for system libraries? I am the system libraries".
  • Since people kept complaining, I've fixed the assignments of string literals to non-const char *s.
  • My use of type * name, however, is entirely intentional.
  • If you're using an older compiler, you might have trouble with the anonymous unions and the designated initializers - I think gcc 4.4 requires some extra braces to get them working together. Anything reasonably recent should work fine. Clang and gcc (newer than 4.4, at

Google Play Service を使う

ライブラリプロジェクト google-play-services_lib を読み込む

AndroidManifest.xml に追加

res/AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET" />
@luftreich
luftreich / ping.py
Created April 5, 2014 03:19 — forked from pklaus/ping.py
#!/usr/bin/env python2
"""
Other Repositories of python-ping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* https://github.com/l4m3rx/python-ping supports Python2 and Python3
* https://bitbucket.org/delroth/python-ping