Skip to content

Instantly share code, notes, and snippets.

Working from home forever and ever

Max Claus Nunes maxcnunes

Working from home forever and ever
Block or report user

Report or block maxcnunes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
maxcnunes / dump-request.go
Created Jun 6, 2019
Dump http request in Go
View dump-request.go
// Save a copy of this request for debugging.
requestDump, err := httputil.DumpRequest(r, true)
if err != nil {
fmt.Println("--->DEBUG ERROR", r.URL, err)
fmt.Println("--->DEBUG BODY", r.URL, string(requestDump))
maxcnunes / gist:3e64a3422564f88b5629da5a0ccd4fc1
Created Mar 18, 2019
Docker - list all containers' ip and find container by ip
View gist:3e64a3422564f88b5629da5a0ccd4fc1
for i in $(docker ps -aq); do docker inspect -f '{{.Name}}: IP={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$i"; done | grep <ip-here>
maxcnunes / status_test.go
Last active Mar 9, 2019
Performance over different approaches to get a mask format from a HTTP status code (e.g. 201=2xx, 204=2xx, 405=4xx, 500=5xx)
View status_test.go
package util_test
import (
maxcnunes / result
Created Mar 8, 2019
Performance and memory profiling Go concat vs fmt.Sprintf
View result
go test -bench=. -memprofile=mem0.out -benchmem -benchtime=5s
goos: darwin
goarch: amd64
BenchmarkHello/concat-8 300000000 19.8 ns/op 0 B/op 0 allocs/op
BenchmarkHello/sprintf-8 50000000 119 ns/op 19 B/op 2 allocs/op
maxcnunes /
Last active Dec 25, 2017
Simple script to pull Git PRs
pull_pr() {
git fetch origin refs/pull/$pr_num/head:pr/$pr_num
maxcnunes /
Last active Jan 25, 2017
Remove all node_module folders recursively. Useful to free up disk space by removing the node_module from those projects you have not used for a while.
# Simple version using only "find"
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
View v8-profile-cpu-100-usage.txt
Code move event for unknown code: 0x3c010c699080
Code move event for unknown code: 0x3c010c69b9c0
Code move event for unknown code: 0x3c010c5729a0
Code move event for unknown code: 0x3c010c57daa0
Code move event for unknown code: 0x3c010c5c8f00
Code move event for unknown code: 0x3c010c5d90a0
Statistical profiling result from v8.log, (22371 ticks, 0 unaccounted, 0 excluded).
[Shared libraries]:
ticks total nonlib name
View sqlectron-npm-run-dist.log
μ sqlectron/sqlectron-gui master ❯ npm run dist
> @ dist /Users/maxcnunes/Development/sqlectron/sqlectron-gui
> npm run compile && build --arch all
> @ compile /Users/maxcnunes/Development/sqlectron/sqlectron-gui
> rimraf app/out && cross-env NODE_ENV=production babel-node scripts/compile.js -v
> cleaning old distribution files
brew install dnsmasq
mkdir -pv $(brew --prefix)/etc/
echo 'address=/.dev/' > $(brew --prefix)/etc/dnsmasq.conf
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
sudo mkdir -v /etc/resolver
sudo bash -c 'echo "nameserver" > /etc/resolver/dev'
maxcnunes / load-connection-uri-from-env-config.go
Created Apr 12, 2016
Load connection URI from ENV config
View load-connection-uri-from-env-config.go
func connectionURIFromEnvConfig() string {
errMsg := "no valid connection string provided"
connConfig, err := url.Parse(os.Getenv("DB_PORT"))
if err != nil {
dbHost, dbPort, err := net.SplitHostPort(connConfig.Host)
if err != nil {
You can’t perform that action at this time.