Friday, December 21, 2018

Github: retrieve individual files from Github in a Dockerfile

FROM alpine:edge

ARG githubtoken=1852...

RUN apk add --no-cache curl wget

RUN curl -o /var/mbqt/lib/MBQT/Bootstrap.pm -H "Authorization: token $githubtoken" -H 'Accept: application/vnd.github.v3.raw' -L https://api.github.com/repos///contents/perl/lib/MBQT/Bootstrap.pm

Monday, December 17, 2018

PostgreSQL: output from multi-line pl/pgsql from psql from perl

#!/usr/bin/perl

my $cmd = "psql -Xq --set ON_ERROR_STOP=on --dbname crmmbqt <<'EOS'
";
$cmd .= <<'END';
do
$$
begin
    raise notice '%', pg_is_in_recovery();
end
$$
END
$cmd .= 'EOS
';

print `$cmd`;

PostgreSQL: see the age of locks

Source: https://wiki.postgresql.org/wiki/Lock_Monitoring
select a.pid, c.relname, l.transactionid, l.mode, l.granted, a.usename, a.query, a.query_start, age(now(), a.query_start) as "age" from pg_stat_activity a join pg_locks l on l.pid = a.pid join pg_class c on c.oid = l.relation order by a.query_start

Thursday, December 13, 2018

macOS: match PC keyboard with apple keyboard

In order to match the order of the modifier keys between both types of keyboards, we need to reverse the Option key (⌥) and the Command key (⌘) on the PC keyboard. This can be done in Settings | Keyboard.
This way, we can have, Ctrl, Windows, Alt
match ^, ⌥, ⌘

Wednesday, December 12, 2018

Docker: difference between container and image

Source: In Docker, what's the difference between a container and an image?
See explanation from cbare: "Images are frozen immutable snapshots of live containers..."