Skip to content

Instantly share code, notes, and snippets.

@harryhare
harryhare / exercise-web-crawler.go
Last active September 5, 2024 19:39
Solution to Exercise: Web Crawler https://tour.golang.org/concurrency/10
package main
import (
"fmt"
"time"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
@sj26
sj26 / LICENSE.md
Last active April 7, 2025 21:12
Bash retry function

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit

@pdanford
pdanford / README.md
Last active February 15, 2025 16:54
OSX <--> Linux VPS Copy and Paste

Description

The below enables OSX style copy and paste between a headless X11 desktop (running on a Linux VPS using fluxbox WM and tightvncserver) and OSX using an OSX VNC client.

It works by remapping X11 keys used by xterm and X11 apps to match OSX command-c and command-v copy and paste. Also enables VNC clients to copy and paste between the OSX and X11 desktops. Note that copy paste works both ways when using the RealVNC OSX client, but with Apple's Screen Sharing you can only paste an X11 copy to the OSX desktop (not vise versa) because it doesn't like autocutsel or Linux or something.

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
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

@katta
katta / gitdiff-svnpatch.sh
Created June 16, 2011 08:10
Converts git diff to svn patch format
git diff --no-prefix | sed -e "s/^diff --git [^[:space:]]*/Index:/" -e "s/^index.*/===================================================================/" --ignore-space-at-eol > changes.patch