Skip to content

Instantly share code, notes, and snippets.

View tonycao's full-sized avatar

Tian Cao tonycao

View GitHub Profile
@tonycao
tonycao / pyenv-python38-macos.sh
Created May 25, 2021 18:36 — forked from yatsu/pyenv-python38-macos.sh
Install Python 3.8.6 with pyenv on macOS Big Sur (11)
#!/bin/sh
# 1) Install Xcode 12
# 2) Install command line tools: `xcode-select --install`
# 3) Install Homebrew
# 4) brew install zlib bzip2 xz
CFLAGS="-I$(brew --prefix zlib)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix xz)/include" \
LDFLAGS="-L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib -L$(brew --prefix xz)/lib" \
pyenv install 3.8.6
@tonycao
tonycao / install_elasticsearch_osx.md
Created June 14, 2017 17:55 — forked from djonsson/install_elasticsearch_osx.md
OS X installation instructions for Elasticsearch + Kibana + Marvel

What is this?

Following this guide will set up a local Elasticsearch with Kibana and Marvel using Homebrew and Homebrew Cask

Prerequisites

If you already have Java installed on your system, skip steps Install Cask and Install Java

If you already have Java and Homebrew installed on your system, skip steps Prerequisites, start at Install Elasticsearch and Kibana after running $ brew update

Install Homebrew

  • $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@tonycao
tonycao / how-to-setup-mac-elasticsearch.md
Created June 10, 2017 07:11 — forked from jpalala/how-to-setup-mac-elasticsearch.md
setting up elasticsearch on your mac with brew

Install va homebrew

If you don't have homebrew installed - get homebrew here

Then run: brew install elasticsearch

Configuration

Update the elasticsearch configuration file in /usr/local/etc/elasticsearch/elasticsearch.yml.

@tonycao
tonycao / latency.txt
Created March 24, 2017 06:34 — 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 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@tonycao
tonycao / tmux-cheatsheet.markdown
Created June 6, 2016 21:22 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@tonycao
tonycao / Git checkout remote branch
Created May 25, 2016 20:00 — forked from markSci5/Git checkout remote branch
Git checkout remote branch
//To fetch a branch, you simply need to:
git fetch origin
//This will fetch all of the remote branches for you. With the remote branches
//in hand, you now need to check out the branch you are interested in, giving
//you a local working copy:
git checkout -b test origin/test
@tonycao
tonycao / iterm2-solarized.md
Last active March 2, 2016 16:33 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + oh my zsh + solarized + Meslo powerline font (OSX)

Solarized

@tonycao
tonycao / iterm2-solarized.md
Last active March 2, 2016 16:33 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + oh my zsh + solarized + Meslo powerline font (OSX)

Solarized

@tonycao
tonycao / .ycm_extra_conf.py
Created January 21, 2016 22:00 — forked from jassinm/.ycm_extra_conf.py
c++11 youcompleteme
import os
import ycm_core
from clang_helpers import PrepareClangFlags
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''
@tonycao
tonycao / skiplist.h
Last active September 2, 2015 00:36 — forked from unsuthee/skiplist.h
C++ Implementation of Skiplist
///////////////////////////////////////////////////////////////////////////////
#ifndef _SKIPLIST_H_
#define _SKIPLIST_H_
#include <iostream>
#include <sstream>
///////////////////////////////////////////////////////////////////////////////