Skip to content

Instantly share code, notes, and snippets.

View rtu's full-sized avatar
🎯
Focusing

Tony Tu rtu

🎯
Focusing
  • Canada
View GitHub Profile
@rtu
rtu / cheatsheet.md
Created February 26, 2020 16:18 — forked from julekgwa/cheatsheet.md
Protractor API Cheatsheet with Examples
@rtu
rtu / latency.txt
Created November 14, 2019 15:53 — forked from mikea/latency.txt
Latency numbers every programmer should know
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 4x mutex op, 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
T-Kuhn/VimRcFiles
Code Issues 0 Pull requests 0 Projects 0 Wiki Insights
VimRcFiles/_vsvimrc
@T-Kuhn T-Kuhn added space to ' mapping
6d56059 on Jul 3, 2017
45 lines (30 sloc) 905 Bytes
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
@rtu
rtu / SoundexTests.cs
Created February 4, 2019 21:24 — forked from andersivner/SoundexTests.cs
Test cases for the Soundex TDD exercise. To be added (uncommented) one-by-one from the top. This is the c# version, adapted from https://github.com/jlangr/soundex.
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Soundex.Tests
{
[TestClass]
public class SoundexTests
@rtu
rtu / protractorAPICheatsheet.md
Created January 29, 2019 15:11 — forked from javierarques/protractorAPICheatsheet.md
Protractor API Cheatsheet
@rtu
rtu / config.fish
Created September 13, 2017 14:26 — forked from ronaldsuwandi/config.fish
My personal fish shell config for OS X (better blue colour for directory in dark terminal). Supports git branch and virtualfish for virtualenv
# nice light cyan color instead of dark blue
set -gx LSCOLORS gxfxcxdxbxegedabagacad
function ls --description 'List contents of directory'
command ls -lFG $argv
end
function subl --description 'Launches sublime text in a new window'
command subl -n $argv
end
@rtu
rtu / pyscript.py
Created September 1, 2017 15:37 — forked from nhoffman/pyscript.py
Python script template
#!/usr/bin/env python
"""A simple python script template.
"""
from __future__ import print_function
import os
import sys
import argparse
@rtu
rtu / tweet_listener.py
Created May 17, 2017 14:46 — forked from hugobowne/tweet_listener.py
Here I define a Tweet listener that creates a file called 'tweets.txt', collects streaming tweets as .jsons and writes them to the file 'tweets.txt'; once 100 tweets have been streamed, the listener closes the file and stops listening.
class MyStreamListener(tweepy.StreamListener):
def __init__(self, api=None):
super(MyStreamListener, self).__init__()
self.num_tweets = 0
self.file = open("tweets.txt", "w")
def on_status(self, status):
tweet = status._json
self.file.write( json.dumps(tweet) + '\n' )
self.num_tweets += 1
@rtu
rtu / tweet_listener.py
Created May 17, 2017 14:46 — forked from hugobowne/tweet_listener.py
Here I define a Tweet listener that creates a file called 'tweets.txt', collects streaming tweets as .jsons and writes them to the file 'tweets.txt'; once 100 tweets have been streamed, the listener closes the file and stops listening.
class MyStreamListener(tweepy.StreamListener):
def __init__(self, api=None):
super(MyStreamListener, self).__init__()
self.num_tweets = 0
self.file = open("tweets.txt", "w")
def on_status(self, status):
tweet = status._json
self.file.write( json.dumps(tweet) + '\n' )
self.num_tweets += 1
@rtu
rtu / latency.txt
Created May 17, 2017 07:17 — 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