Skip to content

Instantly share code, notes, and snippets.

View cizixs's full-sized avatar
:octocat:
cloud native coding...

cizixs cizixs

:octocat:
cloud native coding...
View GitHub Profile

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@cizixs
cizixs / coreos_docker_netns_issue.sh
Created November 22, 2016 11:55
修复 coreos 下无法访问 docker netns 的问题: http://cizixs.com/2016/11/22/coreos-docker-netns-issue
#!/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
@cizixs
cizixs / vxlan.sh
Created July 19, 2016 12:27 — forked from chenchun/docker_vxlan.sh
Setup an overlay network on two hosts manually
#!/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
@cizixs
cizixs / cluster.sh
Last active September 27, 2020 17:54
Create swarm cluster in one command.
#!/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
@cizixs
cizixs / human_size.py
Created May 21, 2016 04:03
Convert file/memory size of int number to human readable format.
"""
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:
@cizixs
cizixs / tmux.conf
Created February 18, 2016 06:19
tmux dotfiles
# 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
@cizixs
cizixs / latency.txt
Created January 4, 2016 07:05 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
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
@cizixs
cizixs / v2ex_misson.py
Last active January 6, 2016 08:29
auto login v2ex, and do your daily mission.
#!/usr/bin/python
# -*- coding:utf-8 -*-
import re
import sys
import requests
reload(sys)
sys.setdefaultencoding('utf8')
@cizixs
cizixs / punctuation
Created June 12, 2014 06:25
punctuation
punctuations
===========
## 键盘上的标点符号
符号 | 英文 | 中文
--------- | ----------- | ---------
, | comma | 逗号
. | period | 句号
: | colon | 冒号

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname