Skip to content

Instantly share code, notes, and snippets.

@janetlee
janetlee / Pascal's Triangle
Last active October 27, 2017 06:53
Pascal's Triangle
function triangle(num) {
var result = [[1], [1,1]];
for (var j = 0; j < num; j++) {
// console.log('previousArr', result[result.length-1]);
var previousArr = result[result.length-1];
var tempArr = [];
// for each element of previous array
for (var i = 0; i < previousArr.length ; i++) {
@janetlee
janetlee / installing_cassandra.md
Created December 12, 2017 03:32 — forked from hkhamm/installing_cassandra.md
Installing Cassandra on Mac OS X

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
/**
* Write a function that, given two objects, returns whether or not the two
* are deeply equivalent--meaning the structure of the two objects is the
* same, and so is the structure of each of their corresponding descendants.
*
* Examples:
*
* deepEquals({a:1, b: {c:3}},{a:1, b: {c:3}}); // true
* deepEquals({a:1, b: {c:5}},{a:1, b: {c:6}}); // false
*
@janetlee
janetlee / Cassandra Ubuntu EC2 setup script
Created January 4, 2018 21:29
A WIP not fully vetted out yet, but should get you most of the way there
sudo apt update
sudo apt dist-upgrade -y
sudo apt install -y vim-tiny openjdk-8-jre-headless
curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-key A278B781FE4B2BDA
echo "deb http://www.apache.org/dist/cassandra/debian 22x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
echo "deb-src http://www.apache.org/dist/cassandra/debian 22x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D
gpg --export --armor F758CE318D77295D | sudo apt-key add -
gpg --keyserver pgp.mit.edu --recv-keys 2B5C1B00
@janetlee
janetlee / latency.txt
Created January 11, 2018 01:06 — 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
@janetlee
janetlee / truncate_constrained_table.txt
Created February 7, 2018 00:45
How to truncate a constrained table in MySQL
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE table $table_name;
SET FOREIGN_KEY_CHECKS = 1;
function isLeft(char) {
return (char === "(" || char === "[" || char === "{") ? true : false;
}
function isValidPair(str) {
str.split("");
var stack =[];
var pairs = {")": "(", "]": "[", "}": "{"};
if (str.length <= 1) {
@janetlee
janetlee / interivew_questions.txt
Last active July 19, 2018 18:41
Here is a list of problems I have seen, or my friends have reportedly seen during interviews
* Tic Tac Toe
* Connect Four
* Blackjack
* Priority Queueing/Dequeing
* Calculate State and Federal taxes (Marginal brackets make it harder than you think)
* Create-React-App commenting tool
* Basic Keyword search via API call
* Build a calculator with UI
* Merge Sort
* Calculate the angle between two clock hands if given the time
Learning Data Structures and Algorithms: https://player.oreilly.com/videos/9781771373470
@janetlee
janetlee / cherry-pick.txt
Created May 24, 2018 17:45
I made this page for myself because everything online doesn't mention clearly to fetch the origin and bring your local develop branch up to date with the repo.
git fetch origin -- to get all the remote branches
git pull origin develop -- to ensure your development branch is fully up to date. The response should be up to date, but you never know
git checkout release/X.XX -- to choose release/X.XX as your base branch
git pull – to update the release branch again because you never know what your colleagues are doing
git checkout -b X.XX-hotfix/JIRA-9999 -- to cut a new branch off release/X.XX base branch
git cherry-pick SHA1 -- cherry pick SHA in order to apply them. This is the first SHA to apply.
git cherry-pick SHA2 -- cherry pick the second SHA to apply
git push origin X.XX-hotfix/JIRA-9999 -- push cherry picked commits