Skip to content

Instantly share code, notes, and snippets.

View kladov's full-sized avatar

Boris Kladov kladov

View GitHub Profile
lsof -nP -i4TCP:$PORT | grep LISTEN
const (
BYTE = 1.0 << (10 * iota)
KILOBYTE
MEGABYTE
GIGABYTE
TERABYTE
)
@kladov
kladov / remove-all-branch-keep-master.sh
Last active September 28, 2018 08:27
Remove all local branch but keep master
git branch | grep -v "master" | xargs git branch -D
@kladov
kladov / remove-git-submodule.md
Last active December 15, 2018 22:24
Remove git submodule

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@kladov
kladov / since-start.go
Created February 25, 2019 09:31
Time since start
func main() {
start := time.Now()
elapsed := time.Since(start)
log.Printf("Binomial took %s", elapsed)
}