Skip to content

Instantly share code, notes, and snippets.

View LifeIsStrange's full-sized avatar
🎯
Focusing

LifeIsStrange

🎯
Focusing
View GitHub Profile
@jboner
jboner / latency.txt
Last active July 23, 2024 08:41
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@wumpz
wumpz / gist:5846559
Created June 23, 2013 21:12
list authors of a git repository including commit count and email
git shortlog -e -s -n
@nicowilliams
nicowilliams / fork-is-evil-vfork-is-good-afork-would-be-better.md
Last active May 18, 2024 14:10
fork() is evil; vfork() is goodness; afork() would be better; clone() is stupid

I recently happened upon a very interesting implementation of popen() (different API, same idea) called popen-noshell using clone(2), and so I opened an issue requesting use of vfork(2) or posix_spawn() for portability. It turns out that on Linux there's an important advantage to using clone(2). I think I should capture the things I wrote there in a better place. A gist, a blog, whatever.

This is not a paper. I assume reader familiarity with fork() in particular and Unix in general, though, of course, I link to relevant wiki pages, so if the unfamiliar reader is willing to go down the rabbit hole, they should be able to come ou

@elizarov
elizarov / MultiShotEnumeration.kt
Created May 3, 2017 09:01
Showcase for Kotlin multishot continuations
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
fun main(args: Array<String>) {
enumerate {
if (flip("A")) {
if (flip("B")) 1 else 2
} else {
if (flip("C")) 3 else if (flip("D")) 4 else 5
}
@AdelDima
AdelDima / .zshrc
Last active August 8, 2022 00:20
Cygwin & oh-my-zsh
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="agnoster"

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@kunalkushwaha
kunalkushwaha / runtime-benchmark.md
Last active February 7, 2024 01:17
Runtime performance benchmark result. [containerd vs CRI-containerd vs CRI-O]

Software Versions

$ runc --version
runc version 1.0.0-rc4+dev
commit: f53ad9cec928821a25c2a74eb8bd95558f8cf152-dirty
spec: 1.0.0

$ containerd --version
containerd github.com/containerd/containerd v1.0.0-beta.3-86-g9649a42 9649a428e8c470cddc0d5a3c394f36111f940adc
@rexlow
rexlow / install.sh
Last active March 23, 2023 09:26
Enable zsh in Gcloud shell
##
# This is an adoption from Oh My Zsh for Google Cloud Shell
# author - bobvanluijt
# source - https://github.com/bobvanluijt/google-cloud-shell-pro-zsh
##
main() {
# Install zsh
sudo apt-get -qq update
@abhijeet2096
abhijeet2096 / bst.pl
Created April 1, 2018 05:41
Binary Search Tree Implementation in Prolog
%% Topic : Binary Search Tree Implementation in Prolog
%% Author : Abhijeet Sharma | Akhil Singhal
%% Date : 26/03/2018
%% Course : Paradigms of Programming
%% Sample Inputs
%% Input inl([3,6,1,2,4,7,9],nil,X).
%% X = t(3, t(1, nil, t(2, nil, nil)), t(6, t(4, nil, nil), t(7, nil, t(9, nil, nil))))
@nadavrot
nadavrot / Matrix.md
Last active July 21, 2024 17:27
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of