Skip to content

Instantly share code, notes, and snippets.

@keithmorris
keithmorris / drive-format-ubuntu.md
Last active February 21, 2026 12:58
Partition, format, and mount a drive on Ubuntu
@imjasonh
imjasonh / main.go
Last active October 28, 2021 06:15
Full sample to accompany https://medium.com/@ImJasonH/3285ddd2a1e5
package main
import (
"encoding/json"
"io"
"log"
"net/http"
)
func main() {
@tsenart
tsenart / gist:5fc18c659814c078378d
Last active February 25, 2026 11:21
HTTP Closures
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@elithrar
elithrar / use.go
Last active April 3, 2025 18:10
go/use: Little middleware chains that could. Inspired by comments here: https://github.com/gorilla/mux/pull/36
r := mux.NewRouter()
// Single handler
r.HandleFunc("/form", use(http.HandlerFunc(formHandler), csrf, logging)
// All handlers
http.Handle("/", recovery(r))
// Sub-routers
apiMiddleware := []func(http.Handler) http.Handler{logging, apiAuth, json}
@santiaago
santiaago / sortByDate.go
Last active May 16, 2025 16:06
Sorting an array of dates in Go
package main
import "fmt"
import "time"
import "sort"
func main() {
fmt.Println("Sorting an array of time")
const shortForm = "Jan/02/2006"
t1, _ := time.Parse(shortForm, "Feb/02/2014")
@bgilbert
bgilbert / README.md
Last active December 31, 2015 07:39
Script to delete the label image from an Aperio SVS file

Moved

This script has moved.

@drewolson
drewolson / reflection.go
Last active March 6, 2026 11:34
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`