From 2b2c45df65110e3f768cb31651f4f3528f1da138 Mon Sep 17 00:00:00 2001 From: light <1870499383@qq.com> Date: Mon, 1 Jan 2018 18:06:22 +0800 Subject: [PATCH] 2018 --- ngrok/ngrok.md | 7 +++---- python/virtualenv.md | 2 +- raspberry/main.md | 15 +++++++++++++++ ubuntu/aria2.md | 8 ++++++++ ubuntu/iptables.md | 36 +++++++++++++++++++++++++++++++++++ ubuntu/update-alternatives.md | 8 ++++++++ 6 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 raspberry/main.md create mode 100644 ubuntu/aria2.md create mode 100644 ubuntu/iptables.md create mode 100644 ubuntu/update-alternatives.md diff --git a/ngrok/ngrok.md b/ngrok/ngrok.md index 7b9cfc5..3c40b41 100644 --- a/ngrok/ngrok.md +++ b/ngrok/ngrok.md @@ -29,16 +29,15 @@ sudo make release-server release-client ``` ``` bash -sudo ./bin/ngrokd -tlsKey=server.key -tlsCrt=server.crt -domain="ngrok.hellolight.me" -httpAddr=":8081" -httpsAddr=":8082" +# 服务器上运行服务命令 +sudo ./bin/ngrokd -tlsKey=server.key -tlsCrt=server.crt -domain="ngrok.hellolight.me" -httpAddr=":8081" -httpsAddr=":8082" ``` - ``` bash server_addr: "ngrok.hellolight.me:4443" trust_host_root_certs: false ``` + ./ngrok -subdomain pub -proto=http -config=ngrok.cfg 8000 ./ngrok -subdomain pub -proto=http -config=ngrok.cfg 22 - - diff --git a/python/virtualenv.md b/python/virtualenv.md index 86dfab3..b2840d5 100644 --- a/python/virtualenv.md +++ b/python/virtualenv.md @@ -3,4 +3,4 @@ > virtualenv -p /usr/bin/python3 --system-site-packages venv -> virtualenv -p /usr/bin/python2 --no-site-packages venv \ No newline at end of file +> virtualenv -p /usr/bin/python2 --no-site-packages venv diff --git a/raspberry/main.md b/raspberry/main.md new file mode 100644 index 0000000..fe68a15 --- /dev/null +++ b/raspberry/main.md @@ -0,0 +1,15 @@ +# 树莓派安装使用 + +## linux下 安装 + +``` bash +df -h # 查看已有硬盘 +# 插入sd卡 +df -h # 查看新增磁盘 +fdisk /dev/sdx # 删除增加分区 + +dd bs=4M if=2017-11-29-raspbian-stretch.img of=/dev/sdX # 写入镜像 + +sudo watch -n 5 pkill -USR1 ^dd$ # 查看dd进程 + +``` diff --git a/ubuntu/aria2.md b/ubuntu/aria2.md new file mode 100644 index 0000000..e97e37b --- /dev/null +++ b/ubuntu/aria2.md @@ -0,0 +1,8 @@ +# ubuntu 下安装使用 aria2 + +- http://blog.csdn.net/crazycui/article/details/52205908 + +## 安装 + +> sudo apt install aria2 + diff --git a/ubuntu/iptables.md b/ubuntu/iptables.md new file mode 100644 index 0000000..55e96ed --- /dev/null +++ b/ubuntu/iptables.md @@ -0,0 +1,36 @@ +# linux 下使用iptables 做路由转发 + +- 参考自 http://blog.csdn.net/whatday/article/details/53634954 + +## 环境 + + 两台设备: + ubuntu 16.04 + eth0 192.168.1.2/24 192.168.1.2 + wlan0 10.138.177.83 *.*.*.* + raspberry pi b+ + eth0 192.168.1.10/24 192.168.1.2 + +## iptables 命令 + +参考自 http://man.linuxde.net/iptables + +``` bash +iptables -t 表名 <-A/I/D/R> 规则链名 [规则号] <-i/o 网卡名> -p 协议名 <-s 源IP/源子网> --sport 源端口 <-d 目标IP/目标子网> --dport 目标端口 -j 动作 + +``` + +## 设置静态ip + +> sudo nano /etc/network/interfaces + +``` bash +auto eth0 +iface eth0 inet static +address 192.168.8.100 +netmask 255.255.255.0 +gateway 192.168.8.2 +dns-nameserver 119.29.29.29 +``` + +> sudo /etc/init.d/networking restart # 重启网络 \ No newline at end of file diff --git a/ubuntu/update-alternatives.md b/ubuntu/update-alternatives.md new file mode 100644 index 0000000..8568d01 --- /dev/null +++ b/ubuntu/update-alternatives.md @@ -0,0 +1,8 @@ +# update-alternatives + +``` bash +# 设置优先级 +sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 +# 查询版本 +sudo update-alternatives --query gcc +``` \ No newline at end of file