Skip to content

Instantly share code, notes, and snippets.

View wweic's full-sized avatar
😀
Hacking

Wei Chen wweic

😀
Hacking
View GitHub Profile
#include <vector>
#include <unordered_map>
#include <queue>
using namespace std;
class Solution {
public:
vector<int> topKFrequent(vector<int>& nums, int k) {
vector<int> result;
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
class TrieNode {
public:
// Initialize your data structure here.
TrieNode(): end(false) {
fill_n(node, 26, nullptr);
ubuntu@ip-172-31-11-97:~$ cat run.sh
set -x
sudo rm -rf /var/www/data
VER=1
./local/bin/strace -ff -s 500 -o strace.out ./usr/bin/sourcexr ./sourcexr_config
@wweic
wweic / latency.txt
Created January 9, 2016 19:47 — 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
# zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
@wweic
wweic / rmq.py
Created October 10, 2015 23:37
generic block based rmq
def split(arr, size):
arrs = []
while len(arr) > size:
pice = arr[:size]
arrs.append(pice)
arr = arr[size:]
arrs.append(arr)
return arrs
class BFRMQ():
@wweic
wweic / progressbar.py
Created May 20, 2015 23:02
A smooth progress bar in terminal found online
# Abuse the power of unicode to give smooth progressbars in the terminal
#
# Unicode defines the codepoints 0x2588 up to 0x258F as SOLID BLOCK, LEFT SEVEN
# EIGHTS BLOCK etc.. This can be used for almost pixel-by-pixel painting of a
# progressbar. The Progressbar class does that for you and can also guess what
# width your progressbar should be.
#
# Usage:
# Progressbar(target=100, start=0, reserve=20, columns=None)
# - target is the final numerical goal of the progressbar
#### COLOUR (Solarized 256)
# default statusbar colors
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
# default window title colors
set-window-option -g window-status-fg colour244 #base0
set-window-option -g window-status-bg default
% Some people asked the LaTeX template for http://pluskid.org/assets/chiyuan-resume.pdf
% So I put a sample here. Feel free to use / modify it. Note you need to use xelatex to
% compile it and change the fonts to the ones you prefer and have on your system.
\documentclass[11pt]{article}
\usepackage{color}
\definecolor{ColorURL}{rgb}{0.1,0.12,0.45}
\usepackage[colorlinks=true,urlcolor=ColorURL]{hyperref}
\usepackage{fontspec,xunicode,xltxtra}
\usepackage[left=.8in,right=.8in,top=.9in,bottom=.7in]{geometry}
\usepackage{setspace}
@wweic
wweic / tools.md
Last active August 29, 2015 14:17 — forked from nrc/tools.md

Rust developer tools - status and strategy

Availability and quality of developer tools are an important factor in the success of a programming language. C/C++ has remained dominant in the systems space in part because of the huge number of tools tailored to these lanaguages. Succesful modern languages have had excellent tool support (Java in particular, Scala, Javascript, etc.). Finally, LLVM has been successful in part because it is much easier to extend than GCC. So far, Rust has done pretty well with developer tools, we have a compiler which produces good quality code in reasonable time, good support for debug symbols which lets us leverage C++/lanaguge agnostic tools such as debuggers, profilers, etc., there are also syntax highlighting, cross-reference, code completion, and documentation tools.

In this document I want to layout what Rust tools exist and where to find them, highlight opportunities for tool developement in the short and long term, and start a discussion about where to focus our time an