Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Jian Chang aa65535

  • Beijing, China
View GitHub Profile
@aa65535
aa65535 / TestCalendar.java
Last active Sep 21, 2015
Print formatted calendar
View TestCalendar.java
package calendar;
public class TestCalendar {
public static void main(String[] args) {
ViewCalendar vc = new ViewCalendar(2015);
vc.print();
// vc.print(9);
}
}
@aa65535
aa65535 / cidr_match.html
Last active Aug 29, 2015
Use CIDR match given two ip address.
View cidr_match.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CIDR Match</title>
</head>
<body>
<table>
<tbody>
<tr>
@aa65535
aa65535 / iptab_r.sh
Created Dec 24, 2014
SHADOWSOCKS DNAT
View iptab_r.sh
iptab_r() {
local LOCAL_IP BODY
LOCAL_IP=$(uci get network.lan.ipaddr 2>/dev/null)
BODY=$(echo -e "$IPLIST" | \
awk '$1 ~ /^([0-9]{1,3}\.){3}[0-9]{1,3}/ \
{printf("-A SHADOWSOCKS -d %s -j RETURN\n", $1)}')
iptables-restore -n <<-EOF
*nat
:SHADOWSOCKS - [0:0]
@aa65535
aa65535 / systatus.sh
Created Nov 29, 2014
rpi systatus scrip
View systatus.sh
#!/bin/bash
DELAY=5
PID_FILE=/tmp/systatus.pid
OUT_FILE=/tmp/systatus.json
RX_FILE=/sys/class/net/eth0/statistics/rx_bytes
TX_FILE=/sys/class/net/eth0/statistics/tx_bytes
TEMP_FILE=/sys/class/thermal/thermal_zone0/temp
if [ "stop" = "$1" ]; then
View openwrt_dist_install.sh
#!/bin/sh
CD_VER="1.1.8"
CD_SHA="324844f"
CD_RLS="1"
SS_VER="1.5.3"
SS_SHA="5cc562f"
SS_RLS="1"
SV_VER="0.1.4"
SV_SHA="0d51fd3"
@aa65535
aa65535 / ss-rules
Created Oct 8, 2014
blacklist mode
View ss-rules
#!/bin/sh
# Get argument
getopts :c: opt && CONFIG=$OPTARG
getopts :i: opt && IGNORE=$OPTARG
# Check argument
[ -z $CONFIG ] || [ -z $IGNORE ] && {
echo "Missing argument"
exit 128
@aa65535
aa65535 / autoindex_name_length.patch
Last active Aug 29, 2015
Nginx 打开目录浏览功能后, 可设置文件名显示长度(宽度), 选项名: `autoindex_name_length`, 值为整数 默认: 50. https://github.com/aa65535/Private-Mixed/tree/master/nginx-patch
View autoindex_name_length.patch
--- a/ngx_http_autoindex_module.c Tue Aug 5 19:18:36 2014
+++ b/ngx_http_autoindex_module.c Wed Aug 20 14:17:28 2014
@@ -40,13 +40,12 @@
ngx_flag_t enable;
ngx_flag_t localtime;
ngx_flag_t exact_size;
+ ngx_uint_t name_length;
} ngx_http_autoindex_loc_conf_t;
@aa65535
aa65535 / ss-install.md
Last active Mar 29, 2019
shadowsocks-libev install at Debian or CentOS
View ss-install.md

Debian

cd /tmp
# 编译环境准备&安装依赖包
apt-get install --no-install-recommends build-essential autoconf libtool libssl-dev libpcre3-dev asciidoc xmlto git
# 克隆源码
git clone --recursive https://github.com/shadowsocks/shadowsocks-libev.git
# 开始编译
@aa65535
aa65535 / lftp.sh
Created Jul 21, 2014
lftp同步脚本
View lftp.sh
#!/bin/bash
HOST="123.123.123:21" # FTP服务器地址
USER="username" # FTP用户名
PASS="password" # FTP密码
SCD="/" # 远程根目录
LCD="/home/www/" # 本地根目录
LST="dir1 dir2 dir3" # 要同步的目录, 空格隔开
for RCD in $LST; do
@aa65535
aa65535 / dnsmasq.conf
Last active Aug 29, 2017
dnsmasq config
View dnsmasq.conf
# 并发查询所有上游DNS服务器
all-servers
# 本地DNS缓存最小有效期
min-cache-ttl=3600
# 本地DNS缓存数目
cache-size=65535
# 上游DNS服务器, 可设置多个
server=8.8.4.4
#server=8.8.8.8
server=114.114.114.114
You can’t perform that action at this time.