Skip to content

Instantly share code, notes, and snippets.

@janetlee
janetlee / convertjsoncsv.rb
Created May 4, 2021 18:31 — forked from jordan-thoms/convertjsoncsv.rb
Code to convert json to csv, with correct headings Usage: ruby convertjsoncsv.rb <input file> <output file>
require 'csv'
require 'json'
require "set"
json = JSON.parse(File.open(ARGV[0]).read)["results"]
# Pass 1: Collect headings
headings = SortedSet.new
json.each do |hash|
headings.merge(hash.keys)
end
@janetlee
janetlee / FingerLakes.txt
Created October 15, 2019 15:17
Short lists of Finger Lakes wineries
Get the Garlic Knots at Jerlando's!!!
On Franklin
Keuka Lake:
Keuka Lake Vineyards, https://www.klvineyards.com/, dry rieslings very ageable. Owner is originally from DC. We overbought here but ultimately not that regretful
Dr. Konstantin Frank, http://www.drfrankwines.com/, bubbly!!
McGregor Vineyard, https://www.mcgregorwinery.com/, stranger varietals from Eastern Europe/Caucasus region very plaid/Scottishy interior - try the Saperavi blends
Seneca Lake:
@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
Learning Data Structures and Algorithms: https://player.oreilly.com/videos/9781771373470
@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
function isLeft(char) {
return (char === "(" || char === "[" || char === "{") ? true : false;
}
function isValidPair(str) {
str.split("");
var stack =[];
var pairs = {")": "(", "]": "[", "}": "{"};
if (str.length <= 1) {
@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;
@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 / 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
/**
* 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
*