Skip to content

Instantly share code, notes, and snippets.

View pwrliang's full-sized avatar

Liang Geng pwrliang

View GitHub Profile
@pwrliang
pwrliang / haproxy.cfg
Created June 5, 2019 09:33
利用Haproxy使Ocserv和HTTPS工作在同一端口
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
daemon
@pwrliang
pwrliang / com.shadowsocks.plist
Last active June 3, 2019 06:31
Mac OS startup
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.v2ray</string><!--这个名字必须和文件名一致, 不含.plist-->
<key>Program</key>
<string>/opt/v2ray/v2ray</string>
<key>ProgramArguments</key>
<array>
<string>-config</string>
@pwrliang
pwrliang / config.json
Last active December 9, 2021 04:45
V2Ray on Router
# TCP
iptables -t nat -N V2RAY
iptables -t nat -A V2RAY -d 0.0.0.0/8 -j RETURN
iptables -t nat -A V2RAY -d 127.0.0.0/8 -j RETURN
iptables -t nat -A V2RAY -d 192.168.8.0/24 -j RETURN
# From lans redirect to Dokodemo-door's local port
iptables -t nat -A V2RAY -s 192.168.8.0/24 -p tcp -j REDIRECT --to-ports 12345
iptables -t nat -A PREROUTING -p tcp -j V2RAY
iptables -t nat -A OUTPUT -p tcp -j V2RAY
@pwrliang
pwrliang / top_used_commands.sh
Created April 3, 2019 08:23
常用sh命令总结
1. 从input.txt读取每一行,搜索当前目录下以py结尾的文件,看文件是否包含input.txt中的关键字
for i in `cat ~/input.txt`; do find . -type f -name '*.py' | xargs grep -ni -e $i | grep -v "要排除的关键字" | sort; done > ~/scan.log
@pwrliang
pwrliang / NOTE
Last active November 25, 2018 15:14
Install Softether on RaspberryPi with Local Bridge mode
1. apt-get install dnsmasq
2. Create a "Net Tap Device" in "Local Bridge Settings" of Softether Manager. The tap name is "soft"
sudo update-rc.d softether defaults
@pwrliang
pwrliang / NOTE
Last active November 24, 2018 13:52
V2ray
sudo vim /etc/systemd/system/v2ray.service
# Append under the [Serivce] tag
LimitNOFILE=102400
sudo systemctl daemon-reload
sudo systemctl restart v2ray
@pwrliang
pwrliang / client.sh
Last active November 25, 2018 13:06
ReportIP
url=https://***************/post_ip.php?ip=
while true
do
main_ipv4=`ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'|head -n 1`
main_ipv6=`ifconfig | awk '/inet6/{print $2}'|head -n 1`
curl -k $url"\"$main_ipv4-$main_ipv6\""
sleep 5
done
#crontab -e
@pwrliang
pwrliang / TestClass
Created May 19, 2018 01:50
Put class method into map and call it (C++11)
class TestClass {
public:
enum MethodEnum {
METHOD_1,
METHOD_2,
METHOD_3
};
std::map<MethodEnum, std::function<void(void)>> method_map;
#!/bin/bash
#set -e
# install-wifi - 19/10/2017 - by MrEngman.
UPDATE_SELF=${UPDATE_SELF:-1}
UPDATE_URI="http://downloads.fars-robotics.net/wifi-drivers/install-wifi"
ROOT_PATH=${ROOT_PATH:-"/"}
WORK_PATH=${WORK_PATH:-"${ROOT_PATH}/root"}
@pwrliang
pwrliang / smb.conf
Last active December 9, 2018 05:49
Raspberrypi samba
[global]
netbios name = RASPBERRYPI
server string = The Raspberrypi File Center
workgroup = WORKGROUP
protocol = SMB3
smb encrypt = auto
# allow follow soft links
follow symlinks = yes
wide links = yes
unix extensions = no