注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。
启动新会话:
tmux [new -s 会话名 -n 窗口名]
恢复会话:
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)| #!/usr/bin/env bash | |
| # This script prints out all of your Redis keys and their size in a human readable format | |
| # Copyright 2013 Brent O'Connor | |
| # License: http://www.apache.org/licenses/LICENSE-2.0 | |
| human_size() { | |
| awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } ' | |
| } |
网络地址转换通常涉及在IP包经过路由器或防火墙的时候,修改其源和/或目的地址
Linux 内核中有一个数据包过滤框架(packet filter framework),叫做 netfilter,这个框架使得 Linux 机器可以像路由器一样工作。接下来我们将使用一个命令行工具 iptables 来创建复杂的规则,用于修改和过滤 数据包。毫无意外,和 NAT 相关的最重要的规则,都在 nat 这个(iptables)table 里。这个表有三个预置的 chain:PRETOUTING, OUTPUT 和 POSTROUTING。
PREROUTING 和 POSTROUTING 是最重要的 chain。如名字所示,PRETOUTING chain 负责处理刚刚到达网络接口的数据包,这时还没有做路由判断,因此还不知道这个包是发往本机(local),还是网络内的其他主机。包经过 PRETOUTING chain 之后,将进行路由判 断。如果目的是本机,那接下来的过程将不涉及NAT;如果目的是网络内的其他机器,那包 将会被转发到那台机器,前提是这台机器配置了允许转发。
| # Print Git commit statistics for a specific author | |
| # Usage: git-stats "Linus Torvalds" | |
| git-stats() { | |
| author=${1-`git config --get user.name`} | |
| echo "Commit stats for \033[1;37m$author\033[0m:" | |
| git log --shortstat --author $author -i 2> /dev/null \ | |
| | grep -E 'files? changed' \ | |
| | awk 'BEGIN{commits=0;inserted=0;deleted=0} \ | |
| {commits+=1; if($5!~"^insertion") { deleted+=$4 } \ |
load balance的好处
| import subprocess | |
| def getClipboardData(): | |
| p = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE) | |
| retcode = p.wait() | |
| data = p.stdout.read() | |
| return data |
Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.
Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.