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 / send_an_email.py
Created May 18, 2014 19:54
Send an email with a gmail account using python 3
# smtplib module send mail
import smtplib
TO = 'recipient@mailservice.com'
SUBJECT = 'TEST MAIL'
TEXT = 'Here is a message from python.'
# Gmail Sign In
gmail_sender = 'sender@gmail.com'
@yzhong52
yzhong52 / Cargo.toml
Last active May 9, 2022 02:19
rust_grpc_demo
[package]
name = "rust_grpc_demo"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tonic = "0.7.1"
tokio = { version = "1.18.0", features = ["macros", "rt-multi-thread"] }
@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`
@yzhong52
yzhong52 / main_with_clap.rs
Last active September 17, 2022 15:10
Ascii chord CLI
const FRETBOARD: &str = "◯ ◯ ◯ ◯ ◯ ◯
┌─┬─┬─┬─┬─┐
│ │ │ │ │ │
├─┼─┼─┼─┼─┤
│ │ │ │ │ │
├─┼─┼─┼─┼─┤
│ │ │ │ │ │
└─┴─┴─┴─┴─┘";
use clap::Parser;
@yzhong52
yzhong52 / Dropbox Style Filename
Last active November 30, 2022 12:04
Rename files based on their created date
Dropbox Style Filename
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocksConfig version="1">
<editor>
<colour_sets>
<ACTIVE_COLOUR_SET>
<str>
<![CDATA[modnokai night shift v2]]>
</str>
</ACTIVE_COLOUR_SET>
<ACTIVE_LANG>