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
#!/bin/bash | |
# 配置文件所在目录 | |
CONFIG_DIR='/home/ff/ovpn-data-example' | |
# 服务器ip | |
# SERVER_DOMAIN_IP='192.168.2.133' | |
SERVER_DOMAIN_IP=`curl -s ipinfo.io/ip` | |
# 暴露的 UDP 端口 | |
EXPORT_PORT='1194' | |
# 客户端名字 |
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
#!/bin/bash | |
sudo apt-get install Docker.io | |
sudo docker run -d --privileged -p 8123:443 --name anyconnect -v $HOME/certs:/certs treelite/anyconnect | |
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
#!/bin/bash | |
sudo apt-get install gnutls-bin -y | |
if [ ! -d "~/certs" ]; then | |
mkdir ~/certs | |
fi | |
cd ~/certs | |
# 获取本地ip | |
MYIP=`curl -s ipinfo.io/ip` | |
# 生成ca模版 | |
echo -e "cn = \"${USER}\"\norganization = \"${USER}\"\nserial = 1\nexpiration_days = 3650\nca\nsigning_key\ncert_signing_key\ncrl_signing_key" > ca.tmpl |
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
#!/bin/bash | |
# 用hexo 创建 blog 脚本 | |
sudo apt-get update | |
sudo apt-get install npm nodejs-legacy git -y | |
sudo npm install hexo-cli -g | |
# 初始化 | |
hexo init ~/blog | |
cd ~/blog | |
npm install |
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
from watchdog.observers import Observer | |
from watchdog.events import * | |
import time | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
class FileEventHandler(FileSystemEventHandler): | |
def __init__(self): |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
#encoding:utf-8 | |
# multithread | |
import threading | |
import Queue | |
import time | |
# 实现initQuenue | |
# 实现testfun | |
# 修改线程数 | |
MAX_QUEUE_SIZE = 10001 |
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
#encoding:utf-8 | |
import logging | |
# 创建一个logger | |
logger = logging.getLogger('mylogger') | |
logger.setLevel(logging.DEBUG) | |
# 创建一个handler,用于写入日志文件 | |
fh = logging.FileHandler('test.log') |
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
#! /usr/bin/python | |
""" | |
This simple script makes it easy to create server certificates | |
that are signed by your own Certificate Authority. | |
Mostly, this script just automates the workflow explained | |
in http://www.tc.umn.edu/~brams006/selfsign.html. | |
Before using this script, you'll need to create a private |
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
""" | |
Tools for creating a CA cert and signed server certs. | |
Divined from http://svn.osafoundation.org/m2crypto/trunk/tests/test_x509.py | |
The mk_temporary_xxx calls return a NamedTemporaryFile with certs. | |
Usage ; | |
# Create a temporary CA cert and it's private key | |
cacert, cakey = mk_temporary_cacert() |