Skip to content

Instantly share code, notes, and snippets.

View theory's full-sized avatar
💭
🥃

David E. Wheeler theory

💭
🥃
View GitHub Profile
DO $$
DECLARE
target TEXT;
BEGIN
FOR target IN
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'bucardo'
AND table_name LIKE 'track_%'
LOOP
--- a/bucardo.schema
+++ b/bucardo.schema
@@ -73,8 +73,9 @@ RETURNS TRIGGER
LANGUAGE plpgsql
AS $bc$
BEGIN
-
- NEW.setting = LOWER(NEW.setting);
+ IF NEW.name <> ALL('{log_conflict_file,warning_file,email_debug_file,flatfile_dir,reason_file,stats_script_url,stopfile,log_timer_format}') THEN
+ NEW.setting = LOWER(NEW.setting);
--- a/bucardo
+++ b/bucardo
@@ -8755,7 +8755,8 @@ sub config {
for my $noun (@nouns) {
$noun =~ /(\w+)=(.+)/ or die $setusage;
- my ($setting,$val) = (lc $1,$2);
+ my $setting = lc $1;
+ my $val = $setting eq 'log_timer_format' ? $2 : lc $2;
# Installs build dependency.
$ cpanm --quiet -L try --notest DBI
Successfully installed Test-Simple-1.302140
Successfully installed DBI-1.641
2 distributions installed
# Installs configure dependency.
$ cpanm --quiet -L try --notest Widget::Meta
Successfully installed Module-Build-0.4224
Successfully installed Widget-Meta-0.06
FROM alpine:latest
RUN apk add --update less
ENV TERM xterm-256color
ENTRYPOINT echo -e "Color me \033[31mRED" | less
#!/bin/bash
# Versions:
# 10.4 9.6.9 9.5.13 9.4.18 9.3.23 9.2.24 9.1.24 9.0.19 8.4.22 8.3.23 8.2.23 8.1.23 8.0.26
BASE=$HOME/pg
PGSQL=$BASE/pgsql
PG_DATA=$PGSQL/data
PG_CTL="$PGSQL/bin/pg_ctl -D $PG_DATA"
diff --git a/lib/App/Sqitch/Engine/pg.pm b/lib/App/Sqitch/Engine/pg.pm
index 71a8d2cc..11e55ca1 100644
--- a/lib/App/Sqitch/Engine/pg.pm
+++ b/lib/App/Sqitch/Engine/pg.pm
@@ -45,15 +45,22 @@ has _psql => (
my $self = shift;
my $uri = $self->uri;
my @ret = ( $self->client );
- for my $spec (
- [ username => $self->username ],
+ make PG_CONFIG=/usr/pgsql-9.4/bin/pg_config -j16
sed -e 's/^#undef PLV8_VERSION/#define PLV8_VERSION "2.1.0"/' plv8_config.h.in > plv8_config.h
echo "extern const unsigned char coffee_script_binary_data[] = {" >coffee-script.cc
echo "extern const unsigned char livescript_binary_data[] = {" >livescript.cc
sed -e 's/@PLV8_VERSION@/2.1.0/g' plv8.control.common | g++ -E -P -DLANG_plv8 - > plv8.control
sed -e 's/@LANG_NAME@/plv8/g' plv8.sql.common | sed -e 's/@PLV8_VERSION@/2.1.0/g' | g++ -E -P -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -DLANG_plv8 - > plv8--2.1.0.sql
sed -e 's/@PLV8_VERSION@/2.1.0/g' plv8.control.common | g++ -E -P -DLANG_plcoffee - > plcoffee.control
sed -e 's/@LANG_NAME@/plcoffee/g' plv8.sql.common | sed -e 's/@PLV8_VERSION@/2.1.0/g' | g++ -E -P -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -DLANG_plcoffee - > plcoffee--2.1.0.sq
@theory
theory / reversion.pl
Created July 17, 2017 18:37
Simple script to update the version of a Perl distribution.
#!/usr/bin/perl -pi
BEGIN {
die "Usage: $0 version[, new_version]\n\n" unless @ARGV;
$old = shift;
$new = shift || sprintf('%.2f', $old + .01);
$dir = shift || '.';
@ARGV =
map { print; chomp; $_ }
@theory
theory / golc.pl
Last active June 10, 2017 06:03
My dumb Go source code line counter.
#!/usr/bin/env perl -w
use warnings;
use utf8;
use strict;
use File::Find qw(find);
push @ARGV, '.' unless @ARGV;
my $go_comments = 0;