Skip to content

Instantly share code, notes, and snippets.

View petere's full-sized avatar

Peter Eisentraut petere

View GitHub Profile
@petere
petere / pgbouncer-schema.sql
Created March 25, 2015 00:13
views for accessing PgBouncer statistics via dblink
CREATE EXTENSION dblink;
-- customize start
CREATE SERVER pgbouncer FOREIGN DATA WRAPPER dblink_fdw OPTIONS (host 'localhost',
port '6432',
dbname 'pgbouncer');
CREATE USER MAPPING FOR PUBLIC SERVER pgbouncer OPTIONS (user 'pgbouncer');
-- customize stop
(defconst pgef-subedit-message
"Type 'C-c C-c' once done, or 'C-c C-k' to abort edit"
"Message to post in the minibuffer when an edit buffer is displayed.")
(defvar pgef-subedit-mode-map
;; Use (make-keymap) because (make-sparse-keymap) does not work on Demacs.
(let ((pgef-subedit-mode-map (make-keymap)))
(define-key pgef-subedit-mode-map "\C-c\C-c" 'pgef-subedit-exit)
(define-key pgef-subedit-mode-map "\C-c\C-k" 'pgef-subedit-abort)
@petere
petere / _kitchen
Created April 9, 2014 19:49
zsh completion for test-kitchen
#compdef kitchen
_kitchen() {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments '1: :->cmds'\
'2: :->args'
case $state in
#!/bin/bash
set -eux
sudo apt-get update
packages="postgresql-$PGVERSION postgresql-server-dev-$PGVERSION postgresql-common"
# bug: http://www.postgresql.org/message-id/[email protected]
sudo update-alternatives --remove-all postmaster.1.gz
#!/bin/sh
# script to add apt.postgresql.org to sources.list
# from command like
CODENAME="$1"
# lsb_release is the best interface, but not always available
if [ -z "$CODENAME" ]; then
CODENAME=$(lsb_release -cs 2>/dev/null)
fi
@petere
petere / brew doctor
Created February 12, 2013 20:27
homebrew rabbitmq-c bug report
$ brew doctor
Your system is raring to brew.
@petere
petere / funny_versions.sh
Created August 14, 2012 03:06
list funny Debian versions
grep-dctrl -F Version -e -n -s Version -v '^([[:digit:]]:)?[[:digit:]]+(\.[[:digit:]]+)*[[:alpha:]]?(-[[:digit:]]+)?(.dfsg[[:digit:]]?)?(-[[:digit:]]+(\.[[:digit:]])?(\+b1)?)?(\+nmu[[:digit:]])?$' /var/lib/apt/lists/*_dists_testing_main_source_Sources | sort -u -V | pee "cat" "wc -l"