Skip to content

Instantly share code, notes, and snippets.

View sebastianwebber's full-sized avatar
🏠
Working from home

Sebastian Webber sebastianwebber

🏠
Working from home
View GitHub Profile
@sebastianwebber
sebastianwebber / pg-notify-parallel.go
Last active March 11, 2024 15:45
postgres listen/notifiy with golang and `go-pg`
package main
import (
"log"
"time"
"github.com/go-pg/pg"
)
const maxWorkers = 5
@sebastianwebber
sebastianwebber / README.md
Last active February 28, 2024 20:03
PGPool II and PostgreSQL 9.5 on Centos 7

PGPool II and PostgreSQL 9.5 on Centos 7

About the virtual machines and network details, see this blog post

Instalation

Run on both servers:

yum install postgresql95-server postgresql95-contrib pgpool-II-95
@sebastianwebber
sebastianwebber / README.md
Last active February 19, 2024 11:44
Compilation of the Uber Facts on PostgreSQL to MySQL Migration

Uber facts

Original posts/information

Key points

  • ~50GB MySQL Application
  • Main motivation: PostGis
  • Migration made with a custom tool(xml2pgcopy) and mysqldump on 45min
@sebastianwebber
sebastianwebber / readme.md
Created June 26, 2020 17:36
How to install buildah on ubuntu 20.04

install-buildah-ubuntu-20.04.md

. /etc/os-release
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_${VERSION_ID}/Release.key -O Release.key
sudo apt-key add - < Release.key
sudo apt-get update -qq
sudo apt-get -qq -y install buildah
``
@sebastianwebber
sebastianwebber / README.md
Last active June 25, 2023 00:43
9.3.5 build on centos 7

9.3 build on centos 7

Dependencies

yum install -y wget systemtap-sdt-devel gcc make bison flex perl-devel perl-ExtUtils-Embed readline-devel zlib-devel python-devel openssl-devel pam-devel libxml2-devel libxslt-devel openldap-devel tcl-devel

compiling

@sebastianwebber
sebastianwebber / show-locks.sql
Last active May 8, 2023 12:44
Show locked tables in postgreSQL
-- tested in PostgreSQL 8.4.4
DROP VIEW IF EXISTS vw_all_table_locks CASCADE;
CREATE VIEW vw_all_table_locks AS
SELECT
pg_namespace.nspname as schemaname,
pg_class.relname as tablename,
pg_locks.mode as lock_type,
age(now(),pg_stat_activity.query_start) AS time_running
FROM pg_class
JOIN pg_locks on pg_locks.relation = pg_class.oid
@sebastianwebber
sebastianwebber / benchmarks.sh
Last active March 17, 2023 14:33
Run benchmarks on postgres with pgbench
#!/bin/bash -ex
export PGBIN=/usr/pgsql-9.3/bin
export PGUSER=postgres
export PGDATABASE=bench
export DATADIR=/dados/pgbench
export CLUSTER_LOG=/tmp/benchmark.log
export TOTAL_CPUS=$(grep 'cpu cores' /proc/cpuinfo | uniq | awk '{print $NF}')
@sebastianwebber
sebastianwebber / README.md
Last active July 14, 2022 04:20
enable arm support for docker in fedora 36 on x86_64 machines
@sebastianwebber
sebastianwebber / create-ec2-instance-playbook.yml
Last active May 13, 2022 11:37
Create a EC2 instance with ansible-playbook
---
- hosts: localhost
connection: local
vars:
gather_facts: False
vars:
keypair: "my-keypair-name"
instance_type: m4.large
security_group:
- "vpc-group-1"
@sebastianwebber
sebastianwebber / docker-compose.yml
Last active October 10, 2021 11:49
basic docker-compose for grafana and prometheus
version: '3.1'
volumes:
prometheus_data: {}
grafana_data: {}
services:
prometheus:
image: prom/prometheus
volumes: