Skip to content

Instantly share code, notes, and snippets.

@tommy-muehle
tommy-muehle / dispatcher.go
Last active October 27, 2019 15:10
Event dispatcher
package events
import (
"sync"
"context"
)
type Dispatcher struct {
mutex *sync.RWMutex
listeners map[string][]Listener
@tommy-muehle
tommy-muehle / Dockerfile
Created August 14, 2018 07:50
PHP alpine example
FROM alpine:3.7
MAINTAINER Tommy Muehle <[email protected]>
ENV COMPOSER_HOME /composer
ENV COMPOSER_ALLOW_SUPERUSER 1
ENV PATH /composer/vendor/bin:$PATH
RUN apk --update --progress --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.7/community add \
curl \
php7 \
@tommy-muehle
tommy-muehle / .sql
Created February 15, 2019 07:45
PostgreSQL Index Usage Analysis
SELECT
relname AS TableName,
to_char(seq_scan, '999,999,999,999') AS TotalSeqScan,
to_char(idx_scan, '999,999,999,999') AS TotalIndexScan,
to_char(n_live_tup, '999,999,999,999') AS TableRows,
pg_size_pretty(pg_relation_size(relname :: regclass)) AS TableSize
FROM pg_stat_all_tables
WHERE schemaname = 'public'
AND 50 * seq_scan > idx_scan -- more then 2%
AND n_live_tup > 10000