Skip to content

Instantly share code, notes, and snippets.

@pcolazurdo
pcolazurdo / remove blank lines regex.md
Created October 26, 2020 17:28 — forked from fomightez/remove blank lines regex.md
remove all blank lines using regular expressions
@FBosler
FBosler / retry.py
Last active March 19, 2022 23:50
retry.py
#Copyright 2021 Fabian Bosler
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
# modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom
# the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
# Software.
@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
@fomightez
fomightez / remove blank lines regex.md
Last active February 22, 2024 09:49
remove all blank lines using regular expressions
@nnnnathann
nnnnathann / gist:6002504
Created July 15, 2013 19:05
cURL TIming
#!/bin/bash
URL="$1"
DATA="$2"
MAX_RUNS="$3"
SUM_TIME="0"
i="0"
while [ $i -lt $MAX_RUNS ]; do
TIME=`curl $URL -d $DATA -o /dev/null -s -w %{time_total}`