Skip to content

Instantly share code, notes, and snippets.

View twpayne's full-sized avatar

Tom Payne twpayne

  • Zürich, Switzerland
  • 16:23 (UTC +02:00)
View GitHub Profile
@twpayne
twpayne / arduino_assemble.py
Created March 21, 2015 15:19
Rough-and-ready approximation to Arduino's multi-file sketch assembly process
#!/usr/bin/python
import glob
import re
import os
import sys
def assemble_paths(paths):
"""Assemble multiple files together into a main sketch. paths is a list
@twpayne
twpayne / argbench_test.go
Last active June 14, 2016 20:58
Golang benchmark test
package argbench
import (
"testing"
)
// n limits the size of the constructed arrays, to prevent the benchmarks from
// measuring memory bandwidth instead of performance.
const n = 1024
package argbench
import (
"testing"
)
// n limits the size of the constructed arrays, to prevent the benchmarks from
// measuring memory bandwidth instead of performance.
const n = 1024
@twpayne
twpayne / main.go
Created February 20, 2019 23:43
github.com/twpayne/go-xdg trivial example
package main
import (
"fmt"
xdg "github.com/twpayne/go-xdg"
)
func main() {
bds, err := xdg.NewBaseDirectorySpecification()
@twpayne
twpayne / main.go
Last active March 29, 2019 16:26
github.com/lib/pq race condition
package main
// Run this with:
// $ go test -count=1 -race -timeout=2s -dsn=postgresql://... .
import (
"context"
"database/sql"
"flag"
"strconv"
@twpayne
twpayne / main_test.go
Last active December 4, 2023 09:45
CockroachDB bulk insert test case
package main
import (
"bytes"
"database/sql"
"flag"
"html/template"
"strconv"
"strings"
"testing"