Skip to content

Instantly share code, notes, and snippets.

View sebasrock's full-sized avatar
🎯
Focusing

Juan Sebastian sanchez sebasrock

🎯
Focusing
View GitHub Profile
@sebasrock
sebasrock / revprox.go
Created February 10, 2023 16:23 — forked from thurt/revprox.go
Simple reverse proxy in Go (forked from original to use a struct instead of a closure)
package main
import(
"log"
"net/url"
"net/http"
"net/http/httputil"
)
func main() {
@slok
slok / pprof.md
Last active August 11, 2024 13:38
Go pprof cheat sheet

Enable profiling

Default http server

import (
    _ "net/http/pprof"
    "net/http"
)
@lummie
lummie / enum.go
Last active September 16, 2024 18:03
Golang Enum pattern that can be serialized to json
package enum_example
import (
"bytes"
"encoding/json"
)
// TaskState represents the state of task, moving through Created, Running then Finished or Errorred
type TaskState int