Skip to content

Instantly share code, notes, and snippets.

@jonhoo
jonhoo / README.md
Last active July 19, 2021 10:49
Distributed RWMutex in Go
@J08nY
J08nY / ButtonBot.py
Last active February 4, 2018 11:09
ButtonBot.py v2.3
#!/usr/bin/env python
#-----ButtonBot.py-----#
# #
# made by /u/J08nY #
# v2.3 #
# #
#----------------------#
from urllib import urlencode
import httplib

Git Cheat Sheet

Commands

Getting Started

git init

or

@alganet
alganet / serve.sh
Last active July 17, 2020 05:42
Serve any folder as a web server with $ curl -L http://tinyurl.com/servesh1 | sh
#!/usr/bin/env sh
# serve.sh
# Modular version: https://gist.github.com/alganet/a22a1373dcee7c175d1e
# Expansion on zsh
command -v setopt 2>&1 >/dev/null && setopt SH_WORD_SPLIT
# POSIX on bash
export POSIXLY_CORRECT=1
# Lists files and folders as HTML
@josephabrahams
josephabrahams / .gitconfig
Last active January 19, 2021 15:44
Kaleidoscope Git Configuration
[diff]
tool = Kaleidoscope
[difftool]
prompt = false
[difftool "Kaleidoscope"]
cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"
[merge]
tool = Kaleidoscope
keepBackup = false
[mergetool]
@staltz
staltz / introrx.md
Last active May 15, 2025 10:37
The introduction to Reactive Programming you've been missing
@debasishg
debasishg / gist:8172796
Last active April 20, 2025 12:45
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t
Testing fnv.New64() with size 235886
m = 3391472, n = 235886, k = 10, s = 339148, p = 0.500000, e = 0.001000
Total items: 235886
Bits in partition 0: 170044 (50.1%)
Bits in partition 1: 170171 (50.2%)
Bits in partition 2: 169914 (50.1%)
Bits in partition 3: 170022 (50.1%)
Bits in partition 4: 170144 (50.2%)
Bits in partition 5: 169979 (50.1%)
Bits in partition 6: 170080 (50.1%)
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 14, 2025 00:29
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@jboner
jboner / latency.txt
Last active May 17, 2025 02:27
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