Skip to content

Instantly share code, notes, and snippets.

View vallerion's full-sized avatar
🎯
Focusing

Valeriy vallerion

🎯
Focusing
View GitHub Profile
@vallerion
vallerion / go_cpu_memory_profiling_benchmarks.sh
Created March 30, 2022 11:49 — forked from arsham/go_cpu_memory_profiling_benchmarks.sh
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
[client]
port = 9704
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
@vallerion
vallerion / gist:84c9266170e17344bdfa404333701469
Last active July 21, 2020 14:51
matrix to string in langs

[[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2]] => 1 2 3|1 2 3|1 2 3|1 2

python

"|".join(map(lambda x: " ".join(map(str, x)), matrix))

java

@vallerion
vallerion / equals_json_arrays.sql
Last active December 23, 2019 17:23
mysql equal json array of numbers
drop function sort_asc_json_array_numbers;
create function sort_asc_json_array_numbers (input_json_array text)
returns text
begin
declare result text default input_json_array;
set result = (
select json_arrayagg(val) from (
@vallerion
vallerion / remove-all-from-docker.sh
Created August 14, 2018 06:30 — forked from beeman/remove-all-from-docker.sh
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
docker stop $(docker ps -qa) && docker rm $(docker ps -qa)
# Remove all images
docker rmi -f `docker images -qa `
alias ls='ls -lGFh'
alias la='ls -la'
alias gc='git commit -am'
alias gs='git status'
alias gph='git push'
alias gpl='git pull'
alias kx='kubectl ctx'
alias kn='kubectl ns'
86937 isset
43159 echo
31697 empty
29252 substr
26146 count
24248 is_array
22572 strlen
19365 sprintf
18090 unset
16584 str_replace