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
file = ARGV[0] | |
File.readlines(file).each do |line| | |
if /^#(\d+)/.match(line) | |
ts = Regexp.last_match(1) | |
print Time.at(ts.to_i).to_s + " " | |
else | |
puts line | |
end | |
end |
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 | |
# All these steps look excessive but address | |
# network instability issues created by not doing them | |
gwdev=`netstat -nr | grep default | awk '{ print $6 }' | head -1` | |
if [ -z "$gwdev" ]; then | |
gwdev=en1 | |
fi |
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 | |
tarball=$1 | |
output_img=$2 | |
size=$3 | |
check_tarball() { | |
if [[ ! -s $tarball ]]; then | |
echo "tarball: $tarball not found" >&2 | |
fi |
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 | |
lookup_single_ip() { | |
local ip=$1; shift | |
# 从bgp.he.net获取AS信息. e.g., <td>CHINANET Shanghai province network</td> | |
local data=$(curl -L http://bgp.he.net/ip/$ip 2>/dev/null | grep -A 30 'Announced By' | egrep '^\s*<td>.*</td>\s*$' | egrep -v 'AS[0-9]*</a>' | uniq) | |
# 从<td>标签中取值. e.g., CHINANET Shanghai province network | |
Lookup_single_ip=$(echo $data | awk -F '<' '{print $2}' | awk -F '>' '{print $2}') | |
} |
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
ps auwx | grep -E '\[.*\]' | grep -v grep | awk '{print $NF}' | awk -F/ '{print $1}' | sed 's/\[//g' | sed s'/\]//g' | sort | uniq | sort |
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 | |
if [ $# -lt 3 ];then | |
echo "usage: $pid $key $value" | |
exit 1 | |
fi | |
pid=$1 | |
key=$2 | |
value="${3}ll" |
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
t.co | |
j.mp | |
twitter.com | |
google* |
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
w32tm /config /update /manualpeerlist:121.9.243.170 | |
w32tm /resync |
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 | |
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 |
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 | |
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 |