Skip to content

Instantly share code, notes, and snippets.

@hydra35
hydra35 / openvpn.conf
Created June 22, 2014 12:25
DD-WRT OpenVPN Client Configuration
#/tmp/openvpncl/openvpn.conf
ca /tmp/openvpncl/ca.crt
cert /tmp/openvpncl/client.crt
key /tmp/openvpncl/client.key
management 127.0.0.1 5001
management-log-cache 50
verb 4
mute 5
log-append /var/log/openvpncl
@hydra35
hydra35 / named.conf
Created January 8, 2014 11:01
bind con
options {
listen-on port 53 { 127.0.0.1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
forwarders { 114.114.114.114; 114.114.115.115; };
forward only;
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo "./enable_alternative_gw.sh original_gw alternative_gw"
exit 1
fi
original_gw=$1
gw=$2
#!/bin/bash
ip_file=$1
if [[ -s $ip_file ]]; then
iptables -F -t nat
while read ip
do
iptables -t nat -A POSTROUTING -s $ip -j MASQUERADE
done <$ip_file
else
@hydra35
hydra35 / switch_java6.sh
Last active September 14, 2016 05:18
java7仅有64位版, Chome不支持64位Java. 可通过切换回系统自带的java6解决. 每次升级Java后执行一遍此脚本. 重新安装java即能升级到java7
#!/bin/bash
[[ -d /Library/Internet\ Plug-Ins/disabled ]] || sudo mkdir -p /Library/Internet\ Plug-Ins/disabled
sudo rm -rf /Library/Internet\ Plug-Ins/disabled/JavaAppletPlugin.plugin
sudo mv /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin /Library/Internet\ Plug-Ins/disabled
sudo ln -sf /System/Library/Java/Support/Deploy.bundle/Contents/Resources/JavaPlugin2_NPAPI.plugin /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo ln -sf /System/Library/Frameworks/JavaVM.framework/Commands/javaws /usr/bin/javaws
echo "Switched to Java6, exit"
#!/bin/bash
host=$1
port=$2
rc=$(curl -I http://$host:$port/stats 2>/dev/null | grep -c 'HTTP/1.1 200 OK')
if [[ $rc -eq 1 ]]; then
exit 0
else
w32tm /config /update /manualpeerlist:121.9.243.170
w32tm /resync
@hydra35
hydra35 / gfw.txt
Created May 1, 2013 16:03
翻墙的域名
t.co
j.mp
twitter.com
google*
@hydra35
hydra35 / nginx.conf
Last active May 14, 2021 03:51
to gray, for Ya'An, Si Chuan earthquake
# 1. Make sure you have nginx sub module compiled in
# nginx -V 2>&1 | grep --color=always '\-\-with\-http_sub_module'
# 2. add two directives below at HTTP level
# nginx.conf
http {
# ......
sub_filter '</head>' '<style type="text/css">html{ filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
#!/bin/bash
if [ $# -lt 3 ];then
echo "usage: $pid $key $value"
exit 1
fi
pid=$1
key=$2
value="${3}ll"