Instantly share code, notes, and snippets.

View TestCalendar.java
package calendar;
public class TestCalendar {
public static void main(String[] args) {
ViewCalendar vc = new ViewCalendar(2015);
vc.print();
// vc.print(9);
}
}
View cidr_match.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CIDR Match</title>
</head>
<body>
<table>
<tbody>
<tr>
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]
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"
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
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;
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
# 开始编译
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
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