Skip to content

Instantly share code, notes, and snippets.

View wilmtang's full-sized avatar

William Tang wilmtang

View GitHub Profile
/**
Gets and sets to this dictionary-like type are atomic.
Does not fully implement correct value semantics for copy
operations, since the contained queue is a reference type
and will be shared among copies of this object
*/
struct AtomicDictionary<KeyType:Hashable,ValueType>
{
@vasanthk
vasanthk / System Design.md
Last active December 12, 2025 09:39
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?
@chrisknoll
chrisknoll / Calculate Percentiles
Created June 17, 2015 05:00
Large scale percentile calculation in SQL
with rawData(count_value) as -- replace below query to get the values you would like to find percentiles of
(
select p.YEAR_OF_BIRTH
from dbo.PERSON p
),
overallStats (avg_value, stdev_value, min_value, max_value, total) as
(
select avg(1.0 * count_value) as avg_value,
stdev(count_value) as stdev_value,
min(count_value) as min_value,