Skip to content

Instantly share code, notes, and snippets.

View chrislan815's full-sized avatar
🏠
Working from home

Chris Lan chrislan815

🏠
Working from home
  • Yelp
  • San Francisco/ Petaluma
View GitHub Profile
@gvolpe
gvolpe / shared-state-in-fp.md
Last active March 15, 2022 20:27
Shared State in pure Functional Programming

Shared State in pure Functional Programming

Newcomers to Functional Programming are often very confused about the proper way to share state without breaking purity and end up having a mix of pure and impure code that defeats the purpose of having pure FP code in the first place.

Reason why I decided to write up a beginner friendly guide :)

Use Case

We have a program that runs three computations at the same time and updates the internal state to keep track of the

@debasishg
debasishg / loans.scala
Last active March 31, 2021 22:09
Sample scala code with type constraints and kleisli composition
package net.debasishg.fin
import org.joda.time.DateTime
trait Account {
def no: String
def name: String
def openedOn: DateTime
def closedOn: Option[DateTime]
}
@vasanthk
vasanthk / System Design.md
Last active July 27, 2024 18:36
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@analogue
analogue / stracetree.py
Created June 23, 2015 18:11
strace an existing process tree
#!/usr/bin/python
# strace an existing process tree. `strace -f` only follows newly spawned
# processes which is not always what you want.
import os
import sys
import subprocess
# /proc/[pid]/task/* == directory of threads including self
# /proc/[pid]/task/[pid]/children == child processes