Skip to content

Instantly share code, notes, and snippets.

View tanema's full-sized avatar
🐦

Tim Anema tanema

🐦
View GitHub Profile

Keybase proof

I hereby claim:

  • I am tanema on github.
  • I am timanema (https://keybase.io/timanema) on keybase.
  • I have a public key ASB-TL0sgWCQjhi74q_peFJTNo2FDEgs3llgDLu6uQr1VAo

To claim this, I am signing this object:

@tanema
tanema / id_fuzzing.go
Created July 28, 2020 00:15
If you need a displayable ID but do not want to generate an ID with uniqueness constraints and try and get it into the database without breaking everything, try just encrypting your ID so that it looks like a nice visible ID but also without your secrets it cannot be reverse engineered to the original ID. See it here https://play.golang.org/p/Em…
package main
import (
"fmt"
"strconv"
"strings"
)
const (
// These are secret random numbers that are meant to help encrypt and disguise
@tanema
tanema / example.rb
Last active May 26, 2021 18:22
Create a local key value store using only the standard library in ruby
require 'localstore'
DB.set(key: "value")
DB.exists?(:key) # => true
DB.get(:key) # => "value"
DB.get(:other, "default value") # => default val
DB.get(:other) do
val = computed_val()
DB.set(other: val)
val
@tanema
tanema / hershey.go
Created March 30, 2022 15:52
The most simple threadsafe progress bar in go
package hershey
import (
"fmt"
"math"
"strings"
"sync"
"time"
)