This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <time.h> | |
#include <stdio.h> | |
#include <errno.h> | |
#include <string.h> | |
int main(int argc, char *argv[]) | |
{ | |
struct timespec cur; | |
struct timespec prev; | |
unsigned int ticks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker ps -q | xargs docker kill | |
stop docker | |
cd /var/lib/docker/devicemapper/mnt | |
umount ./* | |
mv /var/lib/docker $dest | |
ln -s $dest /var/lib/docker | |
start docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://cloud.google.com/compute/docs/faq#ipranges | |
#nslookup -q=TXT _cloud-netblocks.googleusercontent.com 8.8.8.8 | |
for LINE in `dig txt _cloud-netblocks.googleusercontent.com +short | tr " " "\n" | grep include | cut -f 2 -d :` | |
do | |
dig txt $LINE +short | |
done | tr " " "\n" | grep ip4 | cut -f 2 -d : | sort -n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
iptables -t nat -F | |
#create a new chain named SHADOWSOCKS | |
iptables -t nat -N SHADOWSOCKS | |
ips=(google.com www.google.com www.google.com.hk 74.125.203.0/24 64.233.188.0/24 114.134.80.0/24 64.18.0.0/20 64.233.160.0/19 66.102.0.0/20 66.249.80.0/20 72.14.192.0/18 74.125.0.0/16 108.177.8.0/21 173.194.0.0/16 207.126.144.0/20 209.85.128.0/17 216.58.192.0/19 216.239.32.0/19) | |
for ip in "${ips[@]}";do | |
iptables -t nat -A SHADOWSOCKS -p tcp -d $ip -j REDIRECT --to-ports 1081 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org | |
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm | |
yum --enablerepo=elrepo-kernel install kernel-ml | |
sudo bash -c 'echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf' | |
sudo bash -c 'echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf' | |
sysctl -p | |
lsmod | grep bbr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
一般查找域名对应的IP,可以用这个命令 nslookup <域名>,但这样找,返回的ip比较少,今天看到一条命令,可以批量查找Google当前的IP范围。 | |
命令及返回的结果如下: | |
# nslookup -q=TXT _netblocks.google.com 8.8.8.8 | |
Server: 8.8.8.8 | |
Address: 8.8.8.8#53 | |
Non-authoritative answer: | |
_netblocks.google.com text = "v=spf1 ip4:64.18.0.0/20 ip4:64.233.160.0/19 ip4:66.102.0.0/20 ip4:66.249.80.0/20 ip4:72.14.192.0/18 ip4:74.125.0.0/16 ip4:108.177.8.0/21 ip4:173.194.0.0/16 ip4:207.126.144.0/20 ip4:209.85.128.0/17 ip4:216.58.192.0/19 ip4:216.239.32.0/19 ~all" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root] | |
path = /root | |
writable = yes | |
read only = no | |
create mask = 0644 | |
directory mask = 0755 | |
write list = root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <execinfo.h> // for backtrace | |
#include <dlfcn.h> // for dladdr | |
#include <cxxabi.h> // for __cxa_demangle | |
#include <cstdio> | |
#include <cstdlib> | |
#include <string> | |
#include <sstream> | |
// This function produces a stack backtrace with demangled function & method names. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vnc4server -geometry 1920x1080 -geometry 800x600 | |
#Xvnc4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fio --name=test --ioengine=libaio --iodepth=128 --rw=rw --bs=4k --direct=1 --size=20g --numjobs=1 --filename=/dev/vdb --runtime 100 --time_based --thread=1 | |
[global] | |
invalidate=1 | |
direct=1 | |
group_reporting=1 | |
ramp_time=5 | |
exitall=1 | |
loops=1 | |
log_avg_msec=5000 | |
ioengine=libaio |