Skip to content

Instantly share code, notes, and snippets.

View arsham's full-sized avatar

Arsham Shirvani arsham

View GitHub Profile
@arsham
arsham / go_cpu_memory_profiling_benchmarks.sh
Last active November 20, 2023 03:42
Go cpu and memory profiling benchmarks. #golang #benchmark
go test -run=. -bench=. -benchtime=5s -count 5 -benchmem -cpuprofile=cpu.out -memprofile=mem.out -trace=trace.out ./package | tee bench.txt
go tool pprof -http :8080 cpu.out
go tool pprof -http :8081 mem.out
go tool trace trace.out
go tool pprof $FILENAME.test cpu.out
# (pprof) list <func name>
# go get -u golang.org/x/perf/cmd/benchstat
benchstat bench.txt
@arsham
arsham / suspend_cronjob.sh
Last active January 12, 2022 15:33
Suspend #kubernetes cronjobs
kubectl patch cronjobs <job-name> -p '{"spec" : {"suspend" : true }}'
# Change the default browser to brave.
xdg-settings set default-web-browser brave-browser.desktop
@arsham
arsham / ssh_github_travis.sh
Created September 16, 2021 08:50
Generate #ssh key that both #github and #travis agree on
ssh-keygen -t rsa -b 4096 -m PEM -f <keyname>
@arsham
arsham / mirror_website.sh
Created August 17, 2018 11:45
Mirror a website with #wget
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent https://example.com
@arsham
arsham / show_ssh_fingerprint.sh
Created July 27, 2020 15:43
Show #ssh fingerprint
ssh-keygen -E md5 -lf ~/.ssh/id_rsa.pub
@arsham
arsham / lint_go_code.sh
Last active April 19, 2020 16:20
Go ultimate linters. #golang #linting
# Installation:
# go get -u github.com/thraxil/cyclo
# go get -u github.com/client9/misspell
# go get -u honnef.co/go/tools/cmd/staticcheck
# go get -u honnef.co/go/tools/cmd/gosimple
# go get -u honnef.co/go/tools/cmd/unused
# go get -u github.com/jgautheron/goconst/cmd/goconst
# go get -u github.com/jgautheron/usedexports
# go get -u mvdan.cc/interfacer
# go get -u github.com/tsenart/deadcode
@arsham
arsham / update_go_tools.sh
Last active January 25, 2020 13:53
Updating go tools. #golang
go get golang.org/x/tools/gopls@latest
go get -u github.com/gableroux/github-release
go get -u golang.org/x/perf/cmd/benchstat
go get -u golang.org/x/tools/cmd/benchcmp
go get -u golang.org/x/tools/cmd/cover
go get -u golang.org/x/tools/cmd/godoc
go get -u golang.org/x/tools/cmd/goimports
go get -u golang.org/x/tools/cmd/gorename
go get -u golang.org/x/tools/cmd/gotype
go get -u golang.org/x/tools/cmd/guru
@arsham
arsham / concatenate multiple csv files in panda.py
Last active September 13, 2019 18:37
concatenate multiple csv files in panda
import glob
import pandas as pd
fds = []
for f in glob.glob("**/*.csv"):
fds.append(pd.read_csv(f))
frame = pd.concat(fds)
@arsham
arsham / kubernetes_dashboard.md
Last active February 18, 2019 17:11
Install and access #kubernetes #dashboard

Install

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml

Access

kubectl proxy

Then browse to: