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: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!
# 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 / 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
@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 / httpdump.sh
Created January 27, 2019 05:39
httpdump base on tcpdump
# string to hex
str2hex () {
echo -n "$@" | xxd -p
}
# httpdump
hdump() {
filter_cmd='s/^E.*?(GET|PUT|POST|HEAD|PATCH|CONNECT|DELETE|TRACE|OPTIONS|HTTP)/\1/'
if [ "$1" = "-m" ];then
method="0x`str2hex $2`"
@si9ma
si9ma / web-servers.md
Created January 25, 2019 06:50 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@si9ma
si9ma / osx-brew-gnu-coreutils-man.sh
Last active February 3, 2019 08:56 — forked from quickshiftin/osx-brew-gnu-coreutils-man.sh
Running GNU coreutils via Homebrew on your Mac? Here's a one-liner to get the manpages working!
# Short of learning how to actually configure OSX, here's a hacky way to use
# GNU manpages for programs that are GNU ones, and fallback to OSX manpages otherwise
alias man='_() { echo $@; man -M $(brew --prefix)/opt/coreutils/libexec/gnuman $@ 1>/dev/null 2>&1; if [ "$?" -eq 0 ]; then man -M $(brew --prefix)/opt/coreutils/libexec/gnuman $@; else man $@; fi }; _'
# see https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
# core
brew install coreutils
# key commands
brew install binutils
brew install diffutils
brew install ed --default-names
brew install findutils --with-default-names
tcpdump advanced filters
========================
Sebastien Wains <sebastien -the at sign- wains -dot- be>
http://www.wains.be
$Id: tcpdump_advanced_filters.txt 36 2013-06-16 13:05:04Z sw $
Notes :
@si9ma
si9ma / config
Last active January 20, 2019 15:53
ssh reuse connections
Host *
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist yes