Skip to content

Instantly share code, notes, and snippets.

View rsc's full-sized avatar

Russ Cox rsc

View GitHub Profile
@rsc
rsc / clpush
Last active September 24, 2015 11:27
script for pushing and popping CLs
#!/bin/sh
set -e
root=$(hg root)
if [ $# = 0 ]; then
for i in $(ls $root/.hg/codereview/cl.* 2>/dev/null)
do
n=$(echo $i | sed 's/.*cl.//')
desc=$(sed -n '/^Description:/,$p' $i | sed -n 2p)
echo +$n' '$desc
@rsc
rsc / ftoa.go
Created July 1, 2011 04:34
Floating Point to Decimal Conversion Is Easy
package main
import (
"fmt"
"math"
"strconv"
)
func ftoa(f float64, prec int) string {
fr, exp := math.Frexp(f)
@rsc
rsc / normalize.go
Created June 26, 2014 17:47
crappy normalization
package main
import "bytes"
var utab = []struct {
v, n uint16
}{
{0x00C0, 0x0041},
{0x00C1, 0x0041},
{0x00C2, 0x0041},
@rsc
rsc / buildall
Last active August 29, 2015 14:14
rebuild and compare all Go targets
#!/bin/bash
# Usage: buildall [-e] [-cmp] [-work]
#
# Builds everything (std) for every GOOS/GOARCH combination but installs nothing.
#
# By default, runs the builds with -toolexec 'toolstash -cmp', to test that the
# toolchain is producing bit identical output to a previous known good toolchain.
#
# Options:
@rsc
rsc / vet2sam
Created February 19, 2015 21:15
go vet -> sam commands
#!/usr/bin/perl
while(<>) {
chomp;
if(/^(\S+):(\d+): [^:]+: (.+) should be (.+)/) {
print "B $1\n";
$old = $3;
$new = $4;
$line = $2;
$old =~ s/([()+])/\\$1/g;
@rsc
rsc / cert.go
Created December 3, 2015 19:57
package main
import (
"crypto/x509"
"encoding/pem"
"log"
)
func main() {
pemData := []byte(chain)
(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
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

Hello world

Hello!

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: