Skip to content

Instantly share code, notes, and snippets.

View zhouchangxun's full-sized avatar
🎯
Focusing

chance zhouchangxun

🎯
Focusing
View GitHub Profile
@zhouchangxun
zhouchangxun / loadbalancer.py
Created July 5, 2018 08:06
a simple loadbalancer implemention with python.
import sys
import socket
import select
import random
from itertools import cycle
# dumb netcat server, short tcp connection
# $ ~ while true ; do nc -l 8888 < server1.html; done
# $ ~ while true ; do nc -l 9999 < server2.html; done
SERVER_POOL = [('10.157.0.238', 8888)]
@zhouchangxun
zhouchangxun / one-key-vpn.sh
Created April 13, 2018 05:41
Install IKEV2 VPN for CentOS6.x/7 (32bit/64bit) or Ubuntu or Debian7/8.*
#! /bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#===============================================================================================
# System Required: CentOS6.x/7 (32bit/64bit) or Ubuntu
# Description: Install IKEV2 VPN for CentOS and Ubuntu
# Author: quericy
# Intro: https://quericy.me/blog/699
#===============================================================================================
@zhouchangxun
zhouchangxun / day1.js
Created February 27, 2017 06:05 — forked from auser/day1.js
Day1 gist
angular.module('myApp.services', [])
.factory('UserFactory', function($http, $q) {
var service = {
// our factory definition
user: {},
setName: function(newName) {
service.user['name'] = newName;
},
setEmail: function(newEmail) {
service.user['email'] = newEmail;
#!/bin/sh
# Notice special chars inside key like / will replace with _ eg. abc/def => abc_def
SED=/bin/sed
DB=kv.db
ensure_db_exist(){
if [ $1 ];then
DB=$1
fi
if [ ! -f $DB ];then