Skip to content

Instantly share code, notes, and snippets.

View weiofcn's full-sized avatar

Zhou Wei weiofcn

View GitHub Profile
lsblk
parted /dev/sda
(parted) u MiB
(parted) rm 1
(parted) mklabel gpt
(parted) mkpart primary 1 100%
@weiofcn
weiofcn / amqpconsumer
Created March 18, 2019 07:42 — forked from pat1/amqpconsumer
pika bug
import logging
import pika
import time
LOG_FORMAT = ('%(levelname) -1s %(asctime)s %(name) -1s %(funcName) '
'-1s %(lineno) -5d: %(message)s')
LOGGER = logging.getLogger(__name__)
user="user"
@weiofcn
weiofcn / regex_in_find.md
Created September 12, 2018 01:30
Usage of regex in find
find . -regextype sed -regex ".*/af/[0-9]\{1,\}/[0-9]\{1,\}/[0-9]\{1,\}.json"
@weiofcn
weiofcn / xshell.md
Created August 22, 2018 02:02
xshell自动化命令使用
Sub Main
	xsh.Screen.Send("export update_dir=/root/zhouwei/")
	xsh.Screen.Send(VbCr) 
    xsh.Screen.Send("cd /data && rm -rf `date +%Y%m%d` && cd $update_dir && rm * -rf")
    xsh.Screen.Send(VbCr) 
	xsh.Screen.Send("scp root@10.227.101.23:/root/soc_env/CloudSocEnv*.tar.gz .")
	xsh.Screen.Send(VbCr) 
	xsh.Screen.WaitForString "root@10.227.101.23's password:"
	xsh.Screen.Send("kenchow")
rename 's/oldString/newString/' *

比如:before_a_dog.txt替换以后为after_a_dog.txt

sed -i "s/oldString/newString/g"  `grep oldString -rl /path`
@weiofcn
weiofcn / docker-usage.md
Last active March 29, 2018 07:51
docker

权限

usermod -a -G docker $USER

提交

docker commit -a "weiofcn@gmail.com" -m "first commit" 34dc47734372 weiofcn/ubuntu16.04-add-xxx

上库

@weiofcn
weiofcn / delete_mysql.sh
Created March 28, 2018 09:53
删除Ubuntu中的MYSQL
sudo service mysql stop && sudo apt-get --purge remove "mysql*" && sudo rm -rf /etc/mysql/ && sudo rm -rf /var/lib/mysql && sudo apt-get autoremove
@weiofcn
weiofcn / delete_all_image.sh
Created March 28, 2018 09:11
删除Docker中所有的image
#!/bin/bash
# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@weiofcn
weiofcn / Ice服务端中公网和私网地址配置.md
Last active February 5, 2018 06:41
Ice服务端中公网和私网地址配置

Ice服务端中公网和私网地址配置

这个问题主要是出现在购买阿里云和其他有区分公网和私网IP地址云服务器上出现。分配私网地址有很多好处,无论是安全控制,还是做群集和分布式;所以,我们在使用IceGrid的时候,也一定要考虑是不是配置对了。

如何区分自己部署的Ice是不是遇到内外网IP的问题?

设置客户端配置文件中Ice.Trace.Network的等级为1,检查分配的地址是否为云服务器中网卡的地址;如果是那说明就是内外网的问题。

解决办法

add-apt-repository ppa:certbot/certbot
apt update
apt install certbot
certbot certonly --webroot -w /usr/share/nginx/html -d weibot.top -m weiofcn@gmail.com --agree-tos