Skip to content

Instantly share code, notes, and snippets.

View si9ma's full-sized avatar
👏
Go Go Go

si9ma si9ma

👏
Go Go Go
View GitHub Profile
@si9ma
si9ma / README.md
Last active September 3, 2022 12:55 — forked from cld4h/README.md
Bypass the GFW; clash fake-ip and tproxy; iptables and transparent proxy on Linux; 在Linux上通过 iptables 以及 clash 配置透明代理用于本机及局域网翻墙网关; Linux 翻墙路由器配置

This article show you the ultimate way to set up a transparent proxy on Linux using clash and iptables to bypass the GFW in China.

We use:

You can go to github gist to download all files mentioned in this article.

@si9ma
si9ma / gist:49577cf3d997e07bb2908082b8c55ccf
Created June 30, 2019 13:07 — forked from econchick/gist:4666413
Python implementation of Dijkstra's Algorithm
class Graph:
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):
self.nodes.add(value)
def add_edge(self, from_node, to_node, distance):
@si9ma
si9ma / shell_fun_args_parse.sh
Last active May 5, 2019 06:35
parse shell function arguments
fun() {
# usage
read -r -d '' usage << EOM
usage: $0 [-h] [-u=<user>] [-e] [-p=<port>] host
-h help
-u user name
-p ssh port
-e if remote editable?
EOM
@si9ma
si9ma / simple_args_parsing.sh
Created May 4, 2019 01:11 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@si9ma
si9ma / sql2doc.sh
Last active April 30, 2019 13:51
mysql table structure to Microsoft word
# convert mysql table structure to doc
sql2doc() {
[ "$#" -ne "3" ] && echo "usage:$0 [host] [password] [db]" && return
local tmp_file="/tmp/sql2doc.md"
local host="$1"
local passwd="$2"
local db="$3"
# template string

Redis Cluster Setup with Docker Swarm

Setup

./redis.sh

Test

test the redis cluster

@si9ma
si9ma / haproxy.cfg
Created April 19, 2019 14:57 — forked from bhameyie/haproxy.cfg
Sample haproxy config
##based on Mesosphere Marathon's servicerouter.py haproxy config
global
daemon
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
tune.ssl.default-dh-param 2048
defaults
@si9ma
si9ma / jasonette.json
Last active April 1, 2019 14:24
jasonette.json
{
"$jason": {
"head": {
"title": "Jasonbase",
"actions": {
"visit": [
{
"type": "$default"
}
]
@si9ma
si9ma / gist:2fc72c0707777e6cbb499394ed4c41c9
Last active March 11, 2019 07:25 — forked from iedemam/gist:9830045
Automatically manipulate .gitmodules so Travis CI pulls submodules from public URL instead of SSH URL.
#
# I use SSH URLs in my submodules for convenience. However, Travis CI is unable to
# clone from those URLs even though the repositories are public. To fix this, I'm
# simply manipulating the .gitmodules file with sed so it points to the public
# URLs before initializing the submodules.
#
# Hope it saves you some frustration!
#
# disable the default submodule logic
@si9ma
si9ma / bash.generate.random.alphanumeric.string.sh
Created February 28, 2019 17:27 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1