Last active
October 13, 2019 14:30
-
-
Save imjamespond/ec52758aa22937327e65b9c3e4aede01 to your computer and use it in GitHub Desktop.
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
ssh_tunnel.sh | |
sed_reg_replacement_on_mac.sh | |
netcat udp hole punching |
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
for ((i=1; i<=$2; i ++)) | |
do | |
curl.exe $1/${i}.jpg -o ${i}.jpg | |
echo $i | |
done | |
for ((i=1; i<=100; i ++)) | |
do | |
echo $i | |
done | |
for i in {1..100} | |
do | |
echo $i | |
done | |
for i in `seq 1 100` | |
do | |
echo $i | |
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
locah host | |
nc -up 22222 jamespond.eicp.net 11111 | |
remote host | |
nc -lu 11111 -v | |
send something from local... | |
remote host | |
netstat -plan | |
udp 0 0 104.194.77.241:11111 219.137.141.100:35247 ESTABLISHED 19946/nc | |
shutdown local nc | |
nc -lu 22222 | |
remote host | |
nc -up 11111 219.137.141.100 35247 | |
these commands above should run fast or the nat session will be expired soon |
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
for f in ./*; do | |
if [ -f $f ]&&[ `echo $f | grep -c ".js" ` -gt 0 ]; then | |
echo `pwd`/$f | |
sed -E -i '' "s#\"/(management|service-center)/.*\"#GetAbsUrl(&)#" $f | |
sed -E -i '' "s#'/(management|service-center)/.*'#GetAbsUrl(&)#" $f | |
fi | |
done | |
########## | |
Page='./build/index.html' | |
CSS=`grep -oe '/html/static/css/main.*.css' $Page` | |
JS=`grep -oe '/html/static/js/main.*.js' $Page` | |
echo $CSS $JS | |
sed -E -i '' "s#/html/static/css/main\..*\.css#${CSS}#" ${FTL}/html-head.ftl | |
sed -E -i '' "s#/html/static/js/main\..*\.js#${JS}#" ${FTL}/html-foot.ftl |
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
if [[ $(id -u) -ne 0 ]]; then | |
echo "Please run as root" | |
exit | |
fi | |
#echo "docker:1212" | chpasswd | |
#chmod 0600 ./qy1_rsa | |
LOCAL=${1:-'12300'} | |
REMOTE=${2:-'12300'} | |
while true | |
do | |
echo $(date)" ssh tunnel start..." | |
ssh -NT -o ExitOnForwardFailure=yes -o ServerAliveInterval=60 -o ServerAliveCountMax=100 \ | |
-R *:${REMOTE}:localhost:${LOCAL} git@121.201.24.170 -i ./qy1_rsa | |
sleep 30 | |
done |
find some file larger than
find . -type f -size +4096c
to find files bigger than 4096 bytes.
And :
find . -type f -size -4096c
to find files smaller than 4096 bytes.
Notice the + and - difference after the size switch.
The -size switch explained:
-size n[cwbkMG]
File uses n units of space. The following suffixes can be used:
`b' for 512-byte blocks (this is the default if no suffix is
used)
`c' for bytes
`w' for two-byte words
`k' for Kilobytes (units of 1024 bytes)
`M' for Megabytes (units of 1048576 bytes)
`G' for Gigabytes (units of 1073741824 bytes)
The size does not count indirect blocks, but it does count
blocks in sparse files that are not actually allocated. Bear in
mind that the `%k' and `%b' format specifiers of -printf handle
sparse files differently. The `b' suffix always denotes
512-byte blocks and never 1 Kilobyte blocks, which is different
to the behaviour of -ls.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In case you want a hard link
ln
to a directory...mount -t bind /var/www /home/user/workspace/www
This is very dangerous because most tools and programs will not be aware of the binding. I once did something like in the above example and then proceeded to
rm -rf /home/user
. Luckily, there was nothing relevant in/var/www.