Skip to content

Instantly share code, notes, and snippets.

View tomredsky's full-sized avatar

Dermot Paikkos tomredsky

  • Science Photo Library
View GitHub Profile
#!/opt/perl5/bin/perl
use Linux::Inotify2;
use Path::Tiny;
use lib 'lib';
use SPL::AppConfig 'conf';
my $config = conf()->{'Model::DSS'};
my $path = $config->{args}->{spool_dir} . '/mediasets';
ffmpeg -i /var/media/footage/k0/07/62/73/k0076273-hd.mov -v error -y -strict -2 -vcodec h264 -profile:v main -pix_fmt yuvj420p -crf 16 -movflags +faststart -b-pyramid none -weightp none -mixed-refs 0 -8x8dct 0 -trellis 0 -vf scale=384:-1 [scaled]; movie=/etc/perl/share/384x384wm_o36.png [logo]; [scaled][logo] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:rgb=1 [out] /tmp/k0076273-preview-wm.mp4
#!/bin/bash
PSQL="/usr/bin/psql"
PGUSER="dpaikkos"
DBNAME="for_import"
DUMP="www-latest.pg"
REMOTE="proxima"
echo "Fetch $DUMP from $REMOTE"
rm -f $DUMP
@tomredsky
tomredsky / monthly_range.sql
Created October 24, 2018 13:02
Create series on invoice totals by month
-- Collect min and max date range
WITH range_values AS (
SELECT date_trunc('month', min(dat)) as minval,
date_trunc('month', max(dat)) as maxval
from IV),
-- Generate date range in monthly intervals
months as (
SELECT generate_series(minval, maxval, '1 month'::interval) as month
from range_values
set client_encoding='LATIN1';
BEGIN;
DELETE FROM FIELDS WHERE NAME = 'CM.AG2';
ALTER TABLE CM DROP COLUMN AG2;
COMMIT;
BEGIN;
DELETE FROM FIELDS WHERE NAME = 'CM.RG4';
ALTER TABLE CM DROP COLUMN RG4;
COMMIT;
BEGIN;
@tomredsky
tomredsky / upgrade-00.sql
Created February 27, 2019 17:07
media_files table
/* Not creating a fk between spl_number and ct.num
as we may use pg_logical to replicate this table
to the PG DB on www. If we don't it will be trivial
to add one later.
Also not adding a unique key between md5 as there are
about 2,100 duplicates at the moment.
*/
create table media_files(
spl_number varchar(9) not null,
pathpart varchar(64) not null,
#!/bin/bash
PSQL="/usr/bin/psql"
PGUSER="dpaikkos"
DBNAME="import"
DUMP="sirius-latest.pg"
REMOTE="proxima"
rm -f $DUMP
/usr/bin/rsync -La --progress sirius:/data/pg_dumps/latest.pg ${DUMP}
#!/opt/perl5/bin/perl
use v5.22;
use warnings;
use Crypt::CBC;
use MIME::Base64;
my $string = 'U2FsdGVkX18Hda5EdNIpyGFgLgJ1GRiZHUD/8NVKqe4=';
my $cipher = Crypt::CBC->new(
@tomredsky
tomredsky / Artist.pm
Created September 29, 2021 13:22
DBIx example
package MyApp::Schema::Result::Artist;
use warnings;
use strict;
use base qw( DBIx::Class::Core );
__PACKAGE__->table('artist');
__PACKAGE__->add_columns(