start new:
tmux
start new with session name:
tmux new -s myname
| ## remote forward ## | |
| iptables -t nat -A PREROUTING -d LocalIP -p tcp --dport PortNumber -j DNAT --to-destination DestinationIP:Port | |
| iptables -t nat -A POSTROUTING -d estinationIP -p tcp --dport PortNumber -j SNAT --to-source LocalIP | |
| ## local forward ## | |
| iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080 | |
| salt '*' cmd.run 'mkdir ~/.ssh && chmod 700 ~/.ssh' | |
| salt-cp '*' ~/.ssh/id_rsa.pub ~/.ssh/temp.pub | |
| salt '*' cmd.run 'cat ~/.ssh/temp.pub >> ~/.ssh/authorized_keys && rm -f ~/.ssh/temp.pub' |
| :s/vivian/sky/ 替换当前行第一个 vivian 为 sky | |
| :s/vivian/sky/g 替换当前行所有 vivian 为 sky | |
| :n,$s/vivian/sky/ 替换第 n 行开始到最后一行中每一行的第一个 vivian 为 sky | |
| :n,$s/vivian/sky/g 替换第 n 行开始到最后一行中每一行所有 vivian 为 sky | |
| n 为数字,若 n 为 .,表示从当前行开始到最后一行 |
| sed -i "s/oldString/newString/g" `grep oldString -rl /etc` | |
| # -i substitute in place |
| grep -rnw '/path/to/somewhere/' -e "pattern" | |
| -r or -R is recursive, | |
| -n is line number, and | |
| -w stands match the whole word. | |
| -l (lower-case L) can be added to just give the file name of matching files. | |
| Along with these, --exclude or --include parameter could be used for efficient searching. Something like below: | |
| grep --include=\*.{c,h} -rnw '/path/to/somewhere/' -e "pattern" | |
| This will only search through the files which have .c or .h extensions. | |
| download file: scp test.py user@192.168.0.231:/e:/ | |
| download dir: scp -r /opt/test user@192.168.0.231:/e:/ | |
| upload file: scp user@192.168.0.231:/e:/test.py /opt/test | |
| upload dir: scp -r user@192.168.0.231:/e:/test/ /opt/test |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import sys, re | |
| import requests | |
| import Queue | |
| import threading | |
| class Proxy(): | |
| def __init__(self, proxy_url, target_url, ver_keyword, timeout): |