Skip to content

Instantly share code, notes, and snippets.

View pavlenko-volodymyr's full-sized avatar

Volodymyr Pavlenko pavlenko-volodymyr

View GitHub Profile
public class Main {
private static long test(long max) {
long sum = 0;
for (int i = 0; i < max; i++) {
for (int j = i; j > 0; j--) {
sum += j % 10 + j / 10;
}
}
return sum;
}
package main
import (
"fmt"
"math/rand"
"time"
)
func SumAll(max int) int64 {
var sum int64
@pavlenko-volodymyr
pavlenko-volodymyr / System Design.md
Created October 4, 2020 16:57 — forked from vasanthk/System Design.md
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?
def min_marriage_age(age):
pass
@min_marriage_age(22)
class Person:
first_name: str
last_name: str
age: int
min_age: int
const http = require('http')
const { Pool } = require('pg')
const pool = new Pool({
user: '',
database: 'bigint',
password: '',
})
@pavlenko-volodymyr
pavlenko-volodymyr / latency.markdown
Created December 7, 2015 11:08 — forked from valadan/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@pavlenko-volodymyr
pavlenko-volodymyr / cd_latest_run.sh
Last active November 12, 2015 13:25
cd to the directory of the latest task run at mesos slave
#!/bin/sh
MESOS_HOME="/tmp/mesos"
cd "$(\ls -1dt $MESOS_HOME/slaves/*/ | head -n 1)" && \
cd "$(\ls -1dt frameworks/*/ | head -n 1)" && \
cd executors/atropos-executor/runs/latest
@pavlenko-volodymyr
pavlenko-volodymyr / latency.markdown
Last active August 29, 2015 14:26 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

7z
abw
ai
bmp
cab
cr2
csv
djvu
doc
docx