Skip to content

Instantly share code, notes, and snippets.

View m2nx's full-sized avatar
🎃
Pumpking feelings

mmx m2nx

🎃
Pumpking feelings
View GitHub Profile

Big-O Complexity Chart

img

@m2nx
m2nx / add_vps_swap.sh
Created June 4, 2019 07:52
add vps swap
#/bin/bash
sudo install -o root -g root -m 0600 /dev/null /swapfile
dd if=/dev/zero of=/swapfile bs=1k count=2048k
mkswap /swapfile
swapon /swapfile
echo "/swapfile swap swap auto 0 0" | sudo tee -a /etc/fstab
sudo sysctl -w vm.swappiness=10
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf
@m2nx
m2nx / socat.md
Created December 15, 2017 05:19
socat 端口转发

nohup socat TCP4-LISTEN:30000,reuseaddr,fork TCP4:1.1.1.1:30000 >> socat.log 2>&1 &

nohup socat -T 600 UDP4-LISTEN:10000,reuseaddr,fork UDP4:1.1.1.1:10000 >> socat.log 2>&1 &

@m2nx
m2nx / uninstallYunDun.md
Last active December 14, 2017 09:28
卸载阿里云盾
@m2nx
m2nx / ip_forward
Created December 10, 2017 18:09
ip forward
-A PREROUTING -p tcp -m tcp --dport 60000 -j DNAT --to-destination 1.1.1.1:50000
-A PREROUTING -p udp -m udp --dport 60000 -j DNAT --to-destination 1.1.1.1:50000
-A POSTROUTING -d 1.1.1.1/32 -p tcp -m tcp --dport 50000 -j SNAT --to-source [local IP]
-A POSTROUTING -d 1.1.1.1/32 -p udp -m udp --dport 50000 -j SNAT --to-source [local IP]
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
@m2nx
m2nx / speedtest-linux.sh
Created July 25, 2017 17:41
speedtest on linux server
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -
@m2nx
m2nx / gist:fce431901ee0751bc5fa4811b5d636ef
Created July 18, 2017 03:16 — forked from shijinkui/gist:5132586
几个特殊的shell变量
特殊的shell变量:
$0 获取当前执行的shell脚本的文件名
$n 获取当前执行的shell脚本的第n个参数值,n=1..9
$* 获取当前shell的所有参数 “$1 $2 $3 …注意与$#的区别
$# 获取当前shell命令行中参数的总个数