Skip to content

Instantly share code, notes, and snippets.

@tidwall
tidwall / clientserver.go
Last active April 20, 2022 21:59
Simple Client Server using tidwall/sds
package main
import (
"errors"
"log"
"net"
"os"
"time"
"github.com/tidwall/sds"
@tidwall
tidwall / json_test.go
Last active April 19, 2022 22:23
Benchmark encoding json strings in Go (gjson, jsoniter, encoding/json)
package main
import (
"encoding/json"
"testing"
jsoniter "github.com/json-iterator/go"
"github.com/tidwall/gjson"
)
@tidwall
tidwall / main.go
Last active February 23, 2022 23:28
Uhaha using leveldb key/value store
package main
import (
"io"
"os"
"github.com/syndtr/goleveldb/leveldb"
"github.com/tidwall/sds"
"github.com/tidwall/uhaha"
)
@tidwall
tidwall / main.go
Last active July 12, 2021 20:36
Test Tile38 for Expiration Drift
// Test Tile38 for Expiration Drift
// Issue #616
package main
import (
"fmt"
"math/rand"
"sync"
"time"
@tidwall
tidwall / quote4.txt
Created September 1, 2020 18:32
quote4
If my cup won't hold but a pint, and yourn holds a quart, wouldn't ye be mean not to let me have my little half-measure full?
- Sojourner Truth
@tidwall
tidwall / quote3.txt
Created September 1, 2020 18:25
quote3
I attribute my success to this: I never gave or took any excuse.
- Florence Nightingale
@tidwall
tidwall / quote2.txt
Created September 1, 2020 18:25
quote2
A wise man can learn more from a foolish question than a fool can learn from a wise answer.
- Bruce Lee
@tidwall
tidwall / quote1.txt
Created September 1, 2020 18:24
quotes1
Love the life you live. Live the life you love.
- Bob Marley
@tidwall
tidwall / mkvm.sh
Last active March 9, 2020 18:02
Quickly create Debian VMs on Linux
#!/bin/bash
NAME="$1"
TYPE="$2"
usage() {
echo "usage: mkvm.sh name type"
echo ""
echo " name: user-defined name for the vm"
echo " type: (nano,micro,small,medium,large,xlarge,2xlarge)"
@tidwall
tidwall / bench_test.go
Created January 29, 2020 20:53
Benchmark sjson vs Go for simples json updates
package bench
import (
"encoding/json"
"testing"
"github.com/tidwall/sjson"
)
var data = []byte(`{