Skip to content

Instantly share code, notes, and snippets.

View tomredsky's full-sized avatar

Dermot Paikkos tomredsky

  • Science Photo Library
View GitHub Profile
@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(
#!/opt/perl5/bin/perl
use v5.22;
use warnings;
use Crypt::CBC;
use MIME::Base64;
my $string = 'U2FsdGVkX18Hda5EdNIpyGFgLgJ1GRiZHUD/8NVKqe4=';
my $cipher = Crypt::CBC->new(
create type queue_status as enum('new', 'inprogress', 'done');
create table delivery_queue (
delivery_id int not null primary key references dl (id) on delete cascade,
date_entered timestamp not null default current_timestamp,
status queue_status not null default 'new'
);
select n.id,
ml.cod,
us.cod as ini,
mn.nam,
ct.num,
nm.licence_text as rights,
nm.price fee,
n.quote_total as total,
n.quote_currency
from notes n
·
*.tif │··························
*-50mb.jpg │··························
*-1mb.jpg │··························
*-10mb.jpg │··························
*-30mb.jpg
#!/bin/bash
#
# simple pipe_address script to dump mails for 'juno-crm' into 'sirius2::juno/' rsyncd share for processing
#
# ( see: ansible:roles/rsyncd )
# Revision: removed '--perm' arg. 1) it's --perms and 2) let the receiver manager perms
tmp="/tmp/juno_$$"
cat - | tee ${tmp} | head -n 5 | grep ' id' | awk '{ print $2 }' > ${tmp}_id
<!doctype html><html style="margin: 0; padding: 0; width: 100%;"><head style="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title style="">Science Photo Library 105102</title>
<!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:AllowPNG></o:AllowPNG><o:PixelsPerInch>96</o:PixelsPerInch></o:Off
iceDocumentSettings></xml><![endif]-->
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" style="" type="text/css">
<style style="" type="text/css">
body, html{
margin: 0;
#!/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}
@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,
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;