Skip to content

Instantly share code, notes, and snippets.

View aa65535's full-sized avatar
💭
I may be slow to respond.

Jian Chang aa65535

💭
I may be slow to respond.
View GitHub Profile
@aa65535
aa65535 / TestCalendar.java
Last active September 21, 2015 14:30
Print formatted calendar
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 August 29, 2015 14:14
Use CIDR match given two ip address.
<!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 December 24, 2014 11:43
SHADOWSOCKS DNAT
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 November 29, 2014 12:15
rpi systatus scrip
#!/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
#!/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 October 8, 2014 01:31
blacklist mode
#!/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 August 29, 2015 14:04
Nginx 打开目录浏览功能后, 可设置文件名显示长度(宽度), 选项名: `autoindex_name_length`, 值为整数 默认: 50. https://github.com/aa65535/Private-Mixed/tree/master/nginx-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 April 7, 2024 13:03
shadowsocks-libev install at Debian or CentOS

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 July 21, 2014 03:45
lftp同步脚本
#!/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 December 24, 2022 07:12
dnsmasq config
# 并发查询所有上游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