Skip to content

Instantly share code, notes, and snippets.

View gomezjdaniel's full-sized avatar

Daniel Gómez Jurado gomezjdaniel

View GitHub Profile
func foo() {
mylist := []*thing{...}
var wg sync.WaitGroup
ch := make(chan *thing)
for i := 0; i < maxWorkers; i++ {
wg.Add(1)
go worker(&wg, ch)
}
@enricofoltran
enricofoltran / main.go
Last active June 26, 2024 12:16
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@anvk
anvk / psql_useful_stat_queries.sql
Last active July 12, 2024 11:28
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@tcnksm
tcnksm / NOTE.md
Last active April 13, 2024 21:28
Small note of gRPC Best Practice @ CoreOSFest 2017
@001101
001101 / accounting.sql
Created February 18, 2017 09:08 — forked from NYKevin/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...
@nathanl
nathanl / postgresql_serializable_isolation.sql
Last active July 15, 2022 14:11
PostgreSQL Serializable Isolation - false positives
-- (This code was run in PostgreSQL 9.6.1)
-- Demonstration of how serializable isolation for PostgreSQL, which detects possible
-- interference between concurrent transactions, can produce false positives
-- in psql, create the following table
CREATE TABLE users(
id SERIAL NOT NULL PRIMARY KEY,
username VARCHAR NOT NULL
);
{
"Name": "Elvis",
"Location": "Memphis"
}
@harlow
harlow / golang_job_queue.md
Last active July 12, 2024 03:19
Job queues in Golang
@dtjm
dtjm / join_test.go
Last active July 23, 2024 19:31
Benchmarking various ways of concatenating strings in Go
package join
import (
"fmt"
"strings"
"testing"
)
var (
testData = []string{"a", "b", "c", "d", "e"}