Skip to content

Instantly share code, notes, and snippets.

View danyim's full-sized avatar

Daniel Yim danyim

View GitHub Profile
@danyim
danyim / measure-ci.sh
Last active February 21, 2024 23:18
Measure CI runs
#!/usr/bin/env bash
# Method: Go through the "Code Quality Check" workflow and sample all the builds across pages
# https://github.com/SironaMedical/services-frontend/actions/workflows/pull-request.yml?query=is%3Asuccess
# Build caching PR: https://github.com/SironaMedical/services-frontend/pull/3915
# Merged Dec 18, 2023
# Old, pre-optimization GHA run IDs from 12/11/2023 to 12/14/2023
old_runs=(
@danyim
danyim / Storybook CI.md
Last active October 30, 2023 17:01
Storybook CI

Current State

stateDiagram-v2
	direction TB
	state "Commit on feature branch" as FeatureCommit
	state "Merge to main" as MergeToMain
	state "Author & reviewer review published screenshots" as ReviewSS
	state "Storyshots CI Step Triggered" as TriggerCI
	state "Publish feature<>main diff on GH Pages" as PublishDiff
@danyim
danyim / add-amex.js
Created November 22, 2022 05:14
Add All Amex Offers
const offerButtons = document.querySelectorAll('.offer-cta[title="Add to Card"]');
const sz = offerButtons.length - 1
const shouldContinue = confirm(`Found ${sz} available offers, continue?`)
if(shouldContinue === true) {
for (let i = 0; i < sz; ++i) {
console.log(`Accepting offer ${i + 1} of ${sz - 1}`);
offerButtons[i].click();
await new Promise(r => setTimeout(r, 3000));
}
alert("Done!")
@danyim
danyim / install-osm2pgr.sh
Created February 7, 2018 19:33
osm2pgrouting for Ubuntu
# Use with the following AWS AMI:
# Ubuntu Server 16.04 LTS (HVM), SSD Volume Type - ami-79873901
# Install dependencies
sudo apt-get -y update
sudo apt-get -y install expat
sudo apt-get -y install libexpat1-dev
sudo apt-get -y install libboost-dev
sudo apt-get -y install libboost-program-options-dev
sudo apt-get -y install postgresql postgresql-contrib
@danyim
danyim / notes.md
Last active April 26, 2017 23:33
DataEng '17 - Intro to Spark Workshop Notes

Spark Fundamentals Workshop

April 28, 2017 @ Mode Analytics

Spark vs Hadoop

  • Hadoop is a combination of three projects
    1. HDFS is the Hadoop data storage/file system that stores the data
    2. MapReduce/batch processing framework -- open-sourced from MapReduce
    3. YARN (yet another resource negotiator) - resource management
  • Spark takes advantage of processessing through memory instead of saving to disk (Hadoop)
@danyim
danyim / keybase.md
Last active April 16, 2017 23:09
Keybase Proof

Keybase proof

I hereby claim:

  • I am danyim on github.
  • I am danyim (https://keybase.io/danyim) on keybase.
  • I have a public key ASD7spy20tjEuvjI5bdxJPP_aJhqW7JUzNpKBARTSGu9yAo

To claim this, I am signing this object:

@danyim
danyim / findEq.js
Last active July 10, 2019 21:14
Brute-force algorithm for finding a valid equation for a given string of numbers
/*
The first 12 digits of pi are 314159265358. We can make these digits into an
expression evaluating to 27182 (first 5 digits of e) as follows:
3141 * 5 / 9 * 26 / 5 * 3 - 5 * 8 = 27182
or
3 + 1 - 415 * 92 + 65358 = 27182
Notice that the order of the input digits is not changed. Operators (+,-,/,
or *) are simply inserted to create the expression.

Tech Interview Prep

@ Hacker Dojo 7/9/2016

Algorithms

Ordered Statistic Trees

  • Problem: Given a stream of integers, you should be able to provide the median at any given time..
    • Ex. input: [2, 8, 5, 3, 4, 2, .. ]
      • Output (medians at i): [2, 2, 5, 3, 4, 3, 3]
  • Assumption: if you have an even number of values, the lower value is the median
@danyim
danyim / aws-lambda-recv-del-sqs.js
Last active February 12, 2021 16:42
AWS Lambda functions to interact with SQS
var QUEUE_URL = 'https://sqs.us-east-1.amazonaws.com/{{ YOUR SQS }}/bbs-sqs';
var NUM_MSGS_TO_PULL = 1;
var AWS = require('aws-sdk');
var sqs = new AWS.SQS({region : 'us-east-1'});
exports.handler = function(event, context) {
var recvParams = {
QueueUrl: QUEUE_URL,
MaxNumberOfMessages: NUM_MSGS_TO_PULL
};
@danyim
danyim / es-sample
Last active August 29, 2015 14:04
Using the top_hits aggregator
curl -XDELETE "http://localhost:9200/personsearch"
curl -XPUT "http://localhost:9200/personsearch" -d'
{
"settings": {
"index": {
"analysis": {
"analyzer": {
"idx_analyzer": {
"tokenizer": "CommaTokenizer",
"filter": [