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 / 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"

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 / 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
@si9ma
si9ma / gist:a92a7536c060320c5028acc4885d68df
Created February 28, 2019 05:22 — forked from dmitshur/gist:6927554
How to `go get` private repos using SSH key auth instead of password auth.
$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
# http2
import BaseHTTPServer, SimpleHTTPServer
@si9ma
si9ma / gist:507df1f86d698b1ddc78e1daa4783555
Created February 4, 2019 05:07 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: