Skip to content

Instantly share code, notes, and snippets.

View rsc's full-sized avatar

Russ Cox rsc

View GitHub Profile
@rsc
rsc / emoji.md
Created December 15, 2023 19:55
emoji codes
code emoji
+1 👍
-1 👎
100 💯
1234 🔢
1st_place_medal 🥇
2nd_place_medal 🥈
3rd_place_medal 🥉
8ball 🎱
@rsc
rsc / tree.lua
Created July 12, 2023 23:50
tree comparison using lua coroutines
#!/usr/local/bin/lua
function T(l, v, r)
return {left = l, value = v, right = r}
end
function visit(t)
if t ~= nil then -- note: ~= is "not equal"
visit(t.left)
coroutine.yield(t.value)
#!/bin/bash
help="usage: git-generate
git-generate regenerates a commit from a script kept in the commit message.
Specifically, the topmost commit in the current git repo should have a script
preceded by [git-generate] on a line by itself. The script continues until the
end of the message or a Change-Id: line. The script starts execution in the
root of the git repo.
@rsc
rsc / acme.go
Created November 13, 2019 17:07
Acme Tiddler client - does not compile!
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Originally code.google.com/p/rsc/cmd/issue/acme.go,
// then rsc.io/github/issue/acme.go.
// +build !appengine
package main
@rsc
rsc / golang-git-to-mercurial.csv
Created August 15, 2017 19:28
Git hash vs Mercurial hash mapping
We can't make this file beautiful and searchable because it's too large.
git,hg
94151eb2799809ece7e44ce3212aa3cbb9520849,2d1ab17a670a9a35834b2ba0bc85568b62e8b049
31457cef6d6550fff53dd5a80cb276ffa58093c5,94be5d381354added3f084261ff285c48304fe34
db406241107353323b5cf484d6abd05c4722a104,d1238958d4ae41820a540c0c0a7c8e823eae2d48
09d92b6bbf26f195a1fe136513238d227bc73f82,4d000340a76822ab21a6393ab03313971f6ea01d
fa6c54953c756c461073119f02e70930c753bac1,74050a65a1bb8d6d6fc9892f9ce8783201b121cc
dcb2ec3b654eb42d8e6bb6e66801ddf2f7f21c7a,5b665926e5b4d472fc17385cd0b87337fa355b89
7d516079de6a8333817b1c13a45701a02f80d209,f1594a821ec083a2aa04d18ac7f2c9e2e2720e18
b537635a7fa89d7dcf04cb7327d3622d248f78b8,37320bf8fb081f7a2e6685c5b1e4437c193bae81
b9c52302ff50e1299becd13f1b8c60fd69d30496,faa3ed1dc30e42771a68b6337dcf8be9518d5c07

Keybase proof

I hereby claim:

  • I am rsc on github.
  • I am russcox (https://keybase.io/russcox) on keybase.
  • I have a public key ASBhajJfiiWO0NcHGNwsLybnZntWFWmYRInidUw8hm8YJgo

To claim this, I am signing this object:

Hello world

Hello!

Delivered-To: rsc@golang.org
Received: by 10.200.4.132 with SMTP id s4csp1289423qtg;
Mon, 19 Jun 2017 06:56:08 -0700 (PDT)
X-Received: by 10.237.43.134 with SMTP id e6mr26958477qtd.211.1497880568165;
Mon, 19 Jun 2017 06:56:08 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1497880568; cv=none;
d=google.com; s=arc-20160816;
b=K2YnBV/g1wvHaatqN3SWNESVgmS2zbuV/nNfFTFyQl4KUy680lL97quQTJKeaxgJQG
8NJJrtWLun1u0A9m6+Vqcn9NGtSRub/YGQOrHSe/mjAbIclzkYb3QpttxlL886259h5+
K1y/jjJrS7/tsTpfUnseIKDDT8AAGtamKaaLh5KBlQkm7Z/00u/fUFjJOIwlAmZYOsB7
(lldb) b
Current breakpoints:
1: name = 'asdf', locations = 0 (pending)
2: name = 'Test1635', locations = 0 (pending)
3: name = '/Users/rsc/go/misc/cgo/test.Test1635', locations = 0 (pending)
4: address = test.test[0x000000000412dbc0], locations = 1, resolved = 1, hit count = 1
4.1: where = test.test`/Users/rsc/go/misc/cgo/test.Test1635, address = 0x000000000412dbc0, resolved, hit count = 1
@rsc
rsc / cert.go
Created December 3, 2015 19:57
package main
import (
"crypto/x509"
"encoding/pem"
"log"
)
func main() {
pemData := []byte(chain)