Skip to content

Instantly share code, notes, and snippets.

View luftreich's full-sized avatar

luftreich

  • MXB.Ltd
  • Shenzhen.China
View GitHub Profile
@luftreich
luftreich / rename.py
Created July 26, 2016 04:17
File name charset change
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, urllib, sys, getopt
class Renamer:
input_encoding = ""
output_encoding = ""
path = ""
@luftreich
luftreich / Makefile
Last active March 14, 2016 03:56
iptables/netfilter命令、实现及利用 (http://blog.csdn.net/sealyao/article/details/5934268)
obj-m = nethook.o
KVERSION = $(shell uname -r)
all:
make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean
@luftreich
luftreich / gist:aa756f2b968359c3264f
Last active August 28, 2015 10:25 — forked from semack/gist:9654dea80502d7ff3642
led_state_fix_for_uboot_m8_k200_v1.pach
diff --git a/board/amlogic/m8_k200_v1/m8_k200_v1.c b/board/amlogic/m8_k200_v1/m8_k200_v1.c
index b4f2a73..847b099 100755
--- a/board/amlogic/m8_k200_v1/m8_k200_v1.c
+++ b/board/amlogic/m8_k200_v1/m8_k200_v1.c
@@ -561,6 +561,21 @@ void wifi_power_init()
}
#endif
+void set_power_led_state(int flag)
+{
# 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 / KeyEvent.java
Created August 10, 2015 07:18
/work/project/amlS805/aml_new/frameworks/base/core/java/android/view/KeyEvent.java
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@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 就再添加