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 / 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:
@si9ma
si9ma / cb.sh
Last active February 27, 2019 12:43
send data to local clipboard from a remote SSH session
export SSH_FORWARD_PORT=2222
export SSH_CB_CONF='.ssh.cb.client.user' # ssh clipboard configuration
# ssh wrapper
ssh(){
# must -t, in order to run zsh again
# refer : https://unix.stackexchange.com/questions/119894/single-command-to-login-to-ssh-and-run-program
# 这里有BUG,多客户端登录服务器的时候,配置会被覆盖
# TODO 修复BUG
[ "`uname`" = "Darwin" ] && /usr/bin/env ssh -t "$@" -R ${SSH_FORWARD_PORT}:localhost:22 "echo $USER > \$HOME/$SSH_CB_CONF && zsh" && exit # just work on macos
# 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: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."[email protected]:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "[email protected]:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
@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: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 / jasonette.json
Last active April 1, 2019 14:24
jasonette.json
{
"$jason": {
"head": {
"title": "Jasonbase",
"actions": {
"visit": [
{
"type": "$default"
}
]
@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

Redis Cluster Setup with Docker Swarm

Setup

./redis.sh

Test

test the redis cluster

@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