Skip to content

Instantly share code, notes, and snippets.

View iOliverNguyen's full-sized avatar
a new journey

Oliver Nguyen iOliverNguyen

a new journey
View GitHub Profile
@iOliverNguyen
iOliverNguyen / 0_simplest.go
Last active January 9, 2021 04:25
ujson: examples
package main
import "fmt"
import "github.com/olvrng/ujson"
func main() {
input0 := []byte(`true`)
ujson.Walk(input0, func(level int, key, value []byte) bool {
fmt.Printf("level=%v key=%s value=%s\n", level, key, value)
return true
@iOliverNguyen
iOliverNguyen / µjson.go
Last active February 27, 2019 08:11
Minimal JSON parser which works with correct input only
// Minimal JSON parser which works with correct input only.
// Usecase:
// 1. Walk through unstructured json
// 2. Transform unstructured json
// without fully unmarshalling it into a map[string]interface{}
//
// Caution: Behaviour is undefined on invalid json. Use on trusted input only.
package µjson
@iOliverNguyen
iOliverNguyen / get.sh
Created November 29, 2018 09:36
get.sh is a tool for retrieving environment information for scripting with go modules
#!/usr/bin/env bash
this=$0
prog=$(basename $0)
current=$prog
quickusage="Run '$prog help' for usage."
quickusage() {
echo ""
echo "$current: unknown command"
echo "$quickusage"