Skip to content

Instantly share code, notes, and snippets.

View yzhong52's full-sized avatar
⌨️
consider multiple solutions, commit on one, and iterate

Yuchen yzhong52

⌨️
consider multiple solutions, commit on one, and iterate
View GitHub Profile
@yzhong52
yzhong52 / readme.md
Last active November 28, 2021 08:53
System Design in Layman's Terms - Design a Coffee Shop
  • Client (Customer)
  • Load Balancer (Greeter)
  • Data Center (Coffee Shop)
  • Distributed Message Queue (Bulletin Board w/ Sticky Notes)
    • Producer (Cashier)
    • Consumer (Barista)
  • Database (Ledger Book)
@yzhong52
yzhong52 / readme.md
Created September 2, 2019 12:55
Differences between Numpy array and regular python array

In regular python array, a slice view of an array is actually a copy. Modifiying elements through the slice won't affect the original array.

>>> arr = [0, 1, 2]
>>> arr[0:][0] = 100
>>> arr
[0, 1, 2]
@JT501
JT501 / UIReusable+Rx.swift
Created September 3, 2018 09:54
An extension to avoid duplicate subscriptions in UITableCell & UICollectionViewCell
//
// Created by Johnny on 3/9/2018.
// Copyright (c) 2018 Johnny@Co-fire.com. All rights reserved.
//
import UIKit
import RxCocoa
import RxSwift
private var prepareForReuseBag: Int8 = 0
@yzhong52
yzhong52 / readme.md
Last active August 19, 2017 03:29
Sublime Text Settings: Auto Intent, Tap to Spaces, Rulers

Preferences > Key Bindings:

[
    { "keys": ["alt+command+l"], "command": "reindent" , "args": {"single_line": false}}
]

Preferences > Settings:

@brablc
brablc / dnsmasq macOS.md
Last active September 24, 2021 10:24 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

@yzhong52
yzhong52 / gist:f81e929e5810271292bd08856e2f4512
Last active June 18, 2022 13:53
Create Spark DataFrame From List[Any]
// Spark 2.1
val spark = SparkSession.builder().master("local").getOrCreate()
// Given a list of mixture of strings in integers
val values = List("20030100013280", 1.0)
// Create `Row` from `Seq`
val row = Row.fromSeq(values)
// Create `RDD` from `Row`
@smswz
smswz / GridLayout.swift
Last active July 3, 2023 15:51
A simple custom grid UICollectionViewLayout
// MIT License
//
// Copyright (c) 2016 stable|kernel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@kevin-smets
kevin-smets / 1_kubernetes_on_macOS.md
Last active January 6, 2024 22:04
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@wgins
wgins / people2csv.py
Last active May 31, 2018 19:05 — forked from marinamixpanel/people2csv.py
Mixpanel - Exporting people profiles to CSV
''' people export'''
import base64
import csv
import sys
import time
import urllib # for url encoding
import urllib2 # for sending requests
try:
@wenchy
wenchy / Makefile
Last active January 16, 2024 15:36
Compile all .cpp files into one target under the current directory.
CC := g++
CFLAGS := -Wall -g
TARGET := test
# $(wildcard *.cpp /xxx/xxx/*.cpp): get all .cpp files from the current directory and dir "/xxx/xxx/"
SRCS := $(wildcard *.cpp)
# $(patsubst %.cpp,%.o,$(SRCS)): substitute all ".cpp" file name strings to ".o" file name strings
OBJS := $(patsubst %.cpp,%.o,$(SRCS))
all: $(TARGET)