Skip to content

Instantly share code, notes, and snippets.

View nnguyent's full-sized avatar

nnguyent

  • Ho Chi Minh
View GitHub Profile
@nnguyent
nnguyent / History|-10c8e72d|entries.json
Last active September 30, 2025 08:59 — forked from hSATAC/install redis-cli.sh
Install redis-cli with tls in alpine
{"version":1,"resource":"file:///Users/n7n/dev/cubicasa/api-backend/exporter/pkg/headless/client.go","entries":[{"id":"WXI7.go","source":"Undo Chain Diff","timestamp":1756720987594},{"id":"vNxs.go","source":"Undo Chain Diff","timestamp":1756721019315},{"id":"ZlMP.go","source":"Undo Chain Diff","timestamp":1756721226640},{"id":"Iu2M.go","source":"Undo Chain Diff","timestamp":1756721237584},{"id":"HnXl.go","source":"Undo Chain Diff","timestamp":1756721247811},{"id":"6r6X.go","source":"Undo Chain Diff","timestamp":1756721274689},{"id":"klap.go","source":"Undo Chain Diff","timestamp":1756721319441},{"id":"yEtp.go","source":"Undo Chain Diff","timestamp":1756721338208},{"id":"GzOJ.go","source":"Undo Chain Diff","timestamp":1756721421217},{"id":"FCoF.go","source":"Undo Chain Diff","timestamp":1756721747300},{"id":"bDFa.go","source":"Undo Chain Diff","timestamp":1756721763902},{"id":"F1FC.go","source":"Undo Chain Diff","timestamp":1756721994387},{"id":"XSBg.go","source":"Undo Accept Diff","timestamp":1756722265891},{
@nnguyent
nnguyent / go_cpu_memory_profiling_benchmarks.sh
Created October 24, 2023 12:56 — 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
@nnguyent
nnguyent / postgresql_tuning.sh
Created September 6, 2023 09:37 — forked from michaelkarrer81/postgresql_tuning.sh
[postgresql tuning] How to analyze and tune the postgresql database #database #postgresql
# RESOURCES
# https://blog.codeship.com/tuning-postgresql-with-pgbench/
# http://www.linux-magazin.de/ausgaben/2013/07/postgresql-tuning/5/
# https://blog.timescale.com/timescaledb-vs-6a696248104e
# https://heapanalytics.com/blog/engineering/analyzing-performance-millions-sql-queries-one-special-snowflake
# https://www.citusdata.com/blog/2018/02/15/when-postgresql-blocks/
# https://amplitude.engineering/how-a-single-postgresql-config-change-improved-slow-query-performance-by-50x-85593b8991b0
# https://devcenter.heroku.com/articles/postgresql-indexes
# http://www.craigkerstiens.com/2013/01/10/more-on-postgres-performance/
@nnguyent
nnguyent / redis_cheatsheet.bash
Created May 10, 2023 06:37 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@nnguyent
nnguyent / postgres_queries_and_commands.sql
Created July 31, 2022 12:15 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'