Skip to content

Instantly share code, notes, and snippets.

@levicole
Created August 29, 2013 06:00
Show Gist options
  • Save levicole/6374665 to your computer and use it in GitHub Desktop.
Save levicole/6374665 to your computer and use it in GitHub Desktop.
package main
import (
"time"
"strconv"
"fmt"
)
var NewBase60Vocab [60]string
func init() {
NewBase60Vocab = [60]string{ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "_", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" }
}
func main() {
now := time.Now()
count := strconv.Itoa(11)
dayOfYear := strconv.Itoa(now.YearDay())
year := strconv.Itoa(now.Year())
dateCount, _ := strconv.Atoi(year + dayOfYear + count)
sgx := ""
for dateCount > 0 {
mod := dateCount % 60
sgx = sgx + NewBase60Vocab[mod]
dateCount = (dateCount - mod)/60
}
fmt.Println(sgx)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment