Skip to content

Instantly share code, notes, and snippets.

View tennisonchan's full-sized avatar

Tennison Chan tennisonchan

  • Truewind
  • San Francisco
View GitHub Profile
#!/bin/sh
#
# Setup a work space called `pinboard` with one window and 3 panes.
#
SESSION_NAME="ads-eng"
WINDON_NAME="pinboard"
# check if session already exists
tmux has-session -t ${SESSION_NAME}
launch application "/Applications/iTerm.app"
tell application "iTerm"
create window with default profile
set session1 to current session of current window
tell session1
write text "dev"
write text "pin"
@tennisonchan
tennisonchan / System Design.md
Created October 9, 2018 16:10 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?

JavaScript engine fundamentals: Shapes and Inline Caches

link: https://mathiasbynens.be/notes/shapes-ics

JavaScript Engines:

  • V8; NodeJS
  • SpiderMoney; SpiderNode
  • Charkra; Node Charkra
  • JSC: powering Safari & React Native

JS source code -> parser -> Abstract Sytax Tree

@tennisonchan
tennisonchan / tensorflow_json.py
Created April 7, 2018 05:14 — forked from dmmiller612/tensorflow_json.py
Tensorflow Graph and weights to json and back for training
import tensorflow as tf
import numpy as np
from google.protobuf import json_format
import json
np.random.seed(12345)
def tensorflow_get_weights():
"""

Image Optimization: Beyond The Basics

https://www.youtube.com/watch?v=hQZ7Xg7q7zw

Images are by far the greatest bottleneck to performance on the web, and with the average web page size now about 2.5MB large—images taking up 65% of that.

WebP is a new image format which is smallest and provdes either lossless or lossy compression.

<img
 src="dog-800w.jpg" alt="A dog"
@tennisonchan
tennisonchan / AIA003_tf_estimators.ipynb
Created March 10, 2018 22:41 — forked from yufengg/AIA003_tf_estimators.ipynb
Jupyter notebook for AI Adventures episode 3
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

#Ten Rules for Negotiating a Job Offer

Always Negotiate

You might think to yourself: “well, I don’t want to set high expectations, and the offer is already generous, so I ought to just take it.“ No. Negotiate.

Or maybe: “I don’t want to start off on the wrong foot and look greedy with my future employer.“ No. Negotiate.

"But this company is small and—"

@tennisonchan
tennisonchan / hexo-test-csp.js
Last active November 2, 2017 11:55
@include *://*.facebook.com/*;
console.log('Hello!');
@tennisonchan
tennisonchan / regext.js
Last active October 25, 2017 16:13
Reg Extend: to extend native JS RegExp.
const regexExtract = new RegExp('\/(.*)\/([gimuy]+)?');
class RegExt extends RegExp {
constructor(input) {
if (typeof input === 'string' || input instanceof String) {
if (regexExtract.test(input)) {
let parts = regexExtract.exec(input);
super(parts[1], parts[2] || '');
} else {
super(input);