Skip to content

Instantly share code, notes, and snippets.

@alexbosworth
alexbosworth / inotify-channel-backup.md
Last active March 29, 2024 01:33
Backup channel.backup file using systemd and inotify

LND backup script for channel.backup using inotify

Install inotify

sudo apt install inotify-tools

Create script to watch for changes and copy on change

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@paulkernfeld
paulkernfeld / burndns.md
Last active November 28, 2016 12:41
I'm looking for feedback on BurnDNS, a proposal for an efficient decentralized DNS system based on burning bitcoins.

BurnDNS

BurnDNS is a proposal for an efficient decentralized DNS system based on burning bitcoins. It emphasizes ease of implementation and the ability work with SPV clients.

In BurnDNS, anyone can register a new DNS entry by burning (i.e. destroying) bitcoins. Each time you burn bitcoins, you include a mapping from domain name to address. It's possible for one domain name to map to multiple addresses; in this cases, the addresses should be tried in order of the amount of bitcoins burned.

BurnDNS is simple because it uses only the Bitcoin blockchain; there is no other network required for BurnDNS to function. BurnDNS software can be implemented on top of existing Bitcoin libraries.

It's practical because it can be used with simplified payment verification (SPV) clients. This means that a BurnDNS client only ever downloads block headers and relevant transactions. This uses over 10,000 times less bandwidth than downloading the whole blockchain.

mkdown

What is this?

Mkdown renders Markdown GitHub gists with alternative CSS. Use it to elegantly share gists written in Markdown.

How do I use this?

To create your own mkdown URL, append the gist ID in a URL of the form: http://mkdown.com/{GIST ID}. The gist ID is the string at the end of a gist URL.

@anastasop
anastasop / smiley.c
Created September 17, 2012 20:25
smiley.c
// the smiley program demonstrated by Russ Cox at http://research.swtch.com/acme
// it shows that the plan9 compiler http://plan9.bell-labs.com/sys/doc/comp.html fully supports UTF-8
// i tried to compile it with a recent version of the plan9 compiler running on vmware but it failed.
// it seems that older versions of the compiler supported sizeof(void) == 0
// anyway you get the idea
#include <u.h>
#include <libc.h>
@jboner
jboner / latency.txt
Last active May 10, 2024 14: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