Skip to content

Instantly share code, notes, and snippets.

View zzl0's full-sized avatar

zzl zzl0

View GitHub Profile
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
@zzl0
zzl0 / lua_map.c
Created August 27, 2016 00:48 — forked from randrews/lua_map.c
Example of embedding Lua in C
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#include <stdlib.h>
int map_create(lua_State *lua);
int map_slice(lua_State *lua);
int main(int argc, char **argv){
lua_State *lua = lua_open();
@zzl0
zzl0 / gist:dce780ab92fb316aa91d5b3458323bfc
Created September 22, 2016 08:55 — forked from retr0h/gist:1117566
zkpython + homebrew
BREW_HOME=$HOME/.homebrew
$ brew install zookeeper
$ C_INCLUDE_PATH=${BREW_HOME}/Cellar/zookeeper/3.3.3/include/c-client-src/ pip install zkpython
@zzl0
zzl0 / browser_history.md
Created December 28, 2017 04:29 — forked from dropmeaword/browser_history.md
Playing around with Chrome's history

Browser histories

Unless you are using Safari on OSX, most browsers will have some kind of free plugin that you can use to export the browser's history. So that's probably the easiest way. The harder way, which seems to be what Safari wants is a bit more hacky but it will also work for other browsers. Turns out that most of them, including Safari, have their history saved in some kind of sqlite database file somewhere in your home directory.

The OSX Finder cheats a little bit and doesn't show us all the files that actually exist on our drive. It tries to protect us from ourselves by hiding some system and application-specific files. You can work around this by either using the terminal (my preferred method) or by using the Cmd+Shft+G in Finder.

Finder

Once you locate the file containing the browser's history, copy it to make a backup just in case we screw up.

@zzl0
zzl0 / iterm2-solarized.md
Created March 2, 2018 18:52 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@zzl0
zzl0 / athena_cheatsheet.md
Created April 6, 2018 18:16 — forked from steveodom/athena_cheatsheet.md
AWS Athena / Hive / Presto Cheatsheet

Useful Links / Sources

Housekeeping

change column type

ALTER TABLE logs.trades CHANGE recentprice price int;
@zzl0
zzl0 / README.md
Created January 8, 2019 04:11 — forked from joyrexus/README.md
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
Note that this is sandbox. If you have not registered profiles in sandbox you
will need to do so prior to making these calls. You will also need at least
one campaign, ad group, and keyword before you see anything in the report.
While in sandbox, we will return “dummy” data so that you can see how an actual
report would look.
To make it look nicer, I always export my access token prior to making calls.
You could do the same for API-Scope (profile Id) if you wish. Make sure to use
quotes around the access token if it isn’t URL encoded. It has a | (pipe)
symbol and your shell won’t like it.
@zzl0
zzl0 / README.md
Created June 5, 2023 19:58 — forked from borekb/README.md
Why Git doesn't track renames – original email by Linus Torvalds

Why Git doesn't track renames – original email by Linus Torvalds

A copy / backup of Linus' email from 15 Apr 2005.

@zzl0
zzl0 / merger.py
Created September 3, 2023 03:04 — forked from stepchowfun/merger.py
My three-way merge algorithm, originally designed for 6.033 DP2.
#!/usr/bin/python -O
################################################################################
################################################################################
#
# State-Based Text Merging Algorithm
# For 6.033 Design Project 2
# TA: Katherine Fang
# 9 May 2012
#