Skip to content

Instantly share code, notes, and snippets.

Andrew Dunstan adunstan

Block or report user

Report or block adunstan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View scrub_strings.pl
perl -p -e "local \$/ = undef; my \$log = <>; \$log =~ s/('|\\\$[a-zA-Z0-9_]*\\\$)(.*)\$1/\$1 . (q[X] x length(\$2)) . \$1/gme; print \$log;" /tmp/logsamp
@adunstan
adunstan / barman_provision.sh
Created Oct 31, 2018
vagrant provisioner for barman recipes
View barman_provision.sh
#!/bin/sh
HOST=$1
echo provisioning $HOST
yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
if [ "$HOST" = 'postgres' ] ; then
yum install -y \
postgresql10 \
@adunstan
adunstan / appveyor-cranges.yml
Last active Oct 15, 2017
setup for cranges appveyor
View appveyor-cranges.yml
# appveyor.yml
before_build:
- set PATH=C:\Program Files\PostgreSQL\9.6\bin;%PATH%
- cmake -G "Visual Studio 14 2015 Win64"
- dir
- pg_config
build:
project: cranges.sln
@adunstan
adunstan / appveyor.yml
Last active Jun 3, 2018
Setup for appveyor builds
View appveyor.yml
# appveyor.yml
install:
- cinst winflexbison
- '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64'
before_build:
- net user testuser Blurfl9426! /add
- rename c:\ProgramData\chocolatey\bin\win_flex.exe flex.exe
- rename c:\ProgramData\chocolatey\bin\win_bison.exe bison.exe
- curl -S -O https://gist.githubusercontent.com/adunstan/7f18e5db33bb2d73f69ff8c9337a4e6c/raw/buildsetup.pl
View dll2lib.bat
@echo off
rem see http://stackoverflow.com/questions/9946322/how-to-generate-an-import-library-lib-file-from-a-dll#9946390
rem see also http://www.postgresql-archive.org/MSVC-pl-perl-error-message-is-not-verbose-enough-td5913411.html
rem see also https://postgr.es/m/CABcP5fjEjgOsh097cWnQrsK9yCswo4DZxp-V47DKCH-MxY9Gig@mail.gmail.com
REM Usage: dll2lib [32|64] some-file.dll
REM
REM Generates some-file.lib from some-file.dll, making an intermediate
@adunstan
adunstan / gist:fbbdfe646427710233ecb67569665de9
Created Mar 13, 2017
Buildfarm recent timings 2017-03-13
View gist:fbbdfe646427710233ecb67569665de9
pgbfprod=> select s.branch, s.log_stage, count(*), avg(extract(epoch from stage_duration)::numeric(15,2))::numeric(15,1), stddev(extract(epoch from stage_duration)::numeric(15,2))::numeric(15,1) from public.build_status_log s where sysname <> 'crake' and snapshot > now() - interval '10 days' and log_stage !~ 'start|stop' group by s.branch, s.log_stage having count(*) > 20 and avg(extract(epoch from stage_duration)::numeric(15,2)) > 20 order by log_stage, branch <> 'HEAD', branch desc
;
branch | log_stage | count | avg | stddev
---------------+-----------------------------------------------+-------+--------+--------
HEAD | bin-check.log | 388 | 1739.0 | 1758.5
REL9_6_STABLE | bin-check.log | 91 | 1430.5 | 1287.9
REL9_5_STABLE | bin-check.log | 87 | 1140.0 | 994.1
REL9_4_STABLE | bin-check.log | 72 | 751.0 | 66
@adunstan
adunstan / Gen_dummy_probes.pl
Created Mar 5, 2016
s2p translation of Gen_dummy_probes.sed
View Gen_dummy_probes.pl
#!/usr/bin/perl -w
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0;
$0 =~ s/^.*?(\w+)[\.\w+]*$/$1/;
use strict;
use Symbol;
use vars qw{ $isEOF $Hold %wFiles @Q $CondReg
$doAutoPrint $doOpenWrite $doPrint };
$doAutoPrint = 1;
View gist:d8e6193a60ad39e9ff12
package main
import (
"database/sql"
"log"
_ "github.com/lib/pq"
"fmt"
)
func main() {
@adunstan
adunstan / 20mirror-outside-files
Created Nov 25, 2015
etckeeper script for mirroring outside files
View 20mirror-outside-files
#!/bin/sh
set -e
# Based on nealmcb's + ErebusBat's script from http://serverfault.com/questions/211425/
# put this file in etckeeeper's commit.d directory
# in the config file set MIRROR_ROOT (somewhere under /etc) MIRROR_FILES and MIRROR_DIRS
# the latter two can contain wildcards
# all three symbols must be exported or they won't be seen by this script
View gist:3ae53e8b27a8205d2379
with recursive
dag (depended_on,dependent) as
(
values
('b2'::text,'d1'::text),
('d1','d2'),
('d2','d3'),
('d3','d4'),
('b1','a1'),
('b2','a1'),
You can’t perform that action at this time.