Skip to content

Instantly share code, notes, and snippets.

@gagliardetto
gagliardetto / latency.txt
Created November 18, 2025 12:05 — forked from jboner/latency.txt
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
@pwntester
pwntester / lgtm.js
Last active September 30, 2021 21:19
Browser UserScript to show Project Star count for each LGTM result
// ==UserScript==
// @name LGTM stars
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Show star counts
// @author Alvaro Muñoz (@pwntester)
// @match https://lgtm.com/query/*
// @grant none
// @run-at document-idle
// ==/UserScript==
@codref
codref / go-ssh-reverse-tunnel.go
Last active January 22, 2025 16:31
Go SSH reverse tunnel implementation (SSH -R)
/*
Go-Language implementation of an SSH Reverse Tunnel, the equivalent of below SSH command:
ssh -R 8080:127.0.0.1:8080 operatore@146.148.22.123
which opens a tunnel between the two endpoints and permit to exchange information on this direction:
server:8080 -----> client:8080
// junkterm is a quick and dirty serial terminal.
package main
import (
"io"
"log"
"os"
"github.com/pkg/term"
"github.com/spf13/cobra"
@jzelinskie
jzelinskie / client.go
Last active October 27, 2021 03:37
grpc bidirectional streams in golang
package main
import (
"log"
"time"
"golang.org/x/net/context"
"google.golang.org/grpc"
pb "github.com/jzelinskie/grpc/simple"
96: FBProfileSetEventsCalendarSubscriptionStatusMutationOptimisticPayloadFactoryProtocol-Protocol.h
95: FBGroupUpdateRequestToJoinSubscriptionLevelMutationOptimisticPayloadFactoryProtocol-Protocol.h
94: FBEventUpdateNotificationSubscriptionLevelMutationOptimisticPayloadFactoryProtocol-Protocol.h
93: FBReactionUnitUserSettingsDisableUnitTypeMutationOptimisticPayloadFactoryProtocol-Protocol.h
93: FBMemReactionAcornSportsContentSettingsSetShouldNotPushNotificationsResponsePayloadBuilder.h
92: FBReactionUnitUserSettingsEnableUnitTypeMutationOptimisticPayloadFactoryProtocol-Protocol.h
91: FBProfileUpdateSecondarySubscribeStatusMutationOptimisticPayloadFactoryProtocol-Protocol.h
91: FBViewerNotificationsUpdateAllSeenStateMutationOptimisticPayloadFactoryProtocol-Protocol.h
90: FBMemReactionAcornSportsContentSettingsSetShouldPushNotificationsResponsePayloadBuilder.h
89: FBMemReactionAcornTvContentSettingsSetShouldNotPushNotificationsResponsePayloadBuilder.h
@mcastilho
mcastilho / gist:e051898d129b44e2f502
Last active August 23, 2025 02:57
Cheap MapReduce in Go
package main
import (
"bufio"
"encoding/csv"
"encoding/json"
"fmt"
"io"
"os"
"path/filepath"
@harlow
harlow / golang_job_queue.md
Last active August 23, 2025 04:12
Job queues in Golang
@whyrusleeping
whyrusleeping / gob.go
Created October 16, 2014 06:07
golang gob interface example
package main
import (
"bytes"
"encoding/gob"
"fmt"
)
type MyFace interface {
A()
@kachayev
kachayev / concurrency-in-go.md
Last active September 23, 2025 16:12
Channels Are Not Enough or Why Pipelining Is Not That Easy