start new:
tmux
start new with session name:
tmux new -s myname
| [alias] | |
| lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all | |
| lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all | |
| lg = !"git lg1" |
| punctuations | |
| =========== | |
| ## 键盘上的标点符号 | |
| 符号 | 英文 | 中文 | |
| --------- | ----------- | --------- | |
| , | comma | 逗号 | |
| . | period | 句号 | |
| : | colon | 冒号 |
| #!/usr/bin/python | |
| # -*- coding:utf-8 -*- | |
| import re | |
| import sys | |
| import requests | |
| reload(sys) | |
| sys.setdefaultencoding('utf8') |
| Latency Comparison Numbers | |
| -------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns | |
| Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms | |
| Read 4K randomly from SSD* 150,000 ns 0.15 ms |
| # use UTF8 | |
| set -g utf8 | |
| set-window-option -g utf8 on | |
| set -g mode-mouse on | |
| set -g status-bg colour66 | |
| set -g mouse-select-pane on | |
| set -g mouse-select-window on | |
| # make tmux display things in 256 colors |
| """ | |
| From: http://stackoverflow.com/a/1094933/1925083 | |
| Supports: | |
| all currently known binary prefixes | |
| negative and positive numbers | |
| numbers larger than 1000 Yobibytes | |
| arbitrary units (maybe you like to count in Gibibits!) | |
| Example: |
| #!/bin/bash | |
| # This script helps to create a develop docker swarm cluster in one command | |
| # For explanations and details, please refer to https://docs.docker.com/engine/userguide/networking/get-started-overlay/ | |
| set -e | |
| create_kv() { | |
| echo Creating kvstore machine. | |
| docker-machine create -d virtualbox \ | |
| kvstore |
| #!/usr/bin/env bash | |
| function setup_overlay() { | |
| ip netns add overlay | |
| ip netns exec overlay ip li ad dev br0 type bridge | |
| ip li add dev vxlan42 type vxlan id 42 l2miss l3miss proxy learning dstport 4789 | |
| ip link set vxlan42 netns overlay | |
| ip netns exec overlay ip li set dev vxlan42 name vxlan1 | |
| ip netns exec overlay ip li set dev vxlan1 master br0 | |
| ip li add dev vetha1 mtu 1450 type veth peer name vetha2 mtu 1450 |
| #!/bin/sh | |
| set -xe | |
| sudo cp /usr/lib/systemd/system/docker.service /etc/systemd/system/ | |
| sudo sed -i "s/^MountFlags=slave/# MountFlags=slave/g" /etc/systemd/system/docker.service | |
| sudo systemctl daemon-reload | |
| sudo systemctl restart docker |