Skip to content

Instantly share code, notes, and snippets.

View wttw's full-sized avatar

Steve Atkins wttw

View GitHub Profile
-- Schema version ---------------------------------------------------------
create table schema_version (
version integer not null
);
create unique index schema_version_one_row on schema_version((1));
create function schema_version_no_delete () returns trigger as $f$
begin
raise exception 'Cannot delete schema version';
end;
// Package friendly maps user-friendly strings to time.Duration
package friendly
import (
"fmt"
"regexp"
"strconv"
"strings"
"time"
)
{
"hostname": "(?:(?:(?:[^^\\x{0009}-\\x{000D}\\x{0020}\\x{0085}\\x{00A0}\\x{1680}\\x{180E}\\x{2000}-\\x{200A}\\x{2028}\\x{2029}\\x{202F}\\x{205F}\\x{3000}\\x00-\\x2c\\x2e\\x2f\\x3a-\\x40\\x5b-\\x5e\\x60\\x7b-\\x7f]{1,63}\\.){1,4})(?:சிங்கப்பூர்|xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|இந்தியா|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|இலங்கை|ファッション|vermögensberater|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--xkc2al3hye2a|السعودية|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbc0a9azcg|xn--nqv7fs00ema|संगठन|భారత్|嘉里大酒店|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--6qq986b3xl|xn--b4w605ferd|xn--fiq228c5hs|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbb9fbpob|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbx4cd0ab|الجزائ
abacus_temp_qa=# select quote_nullable($$\$$);
quote_nullable
----------------
E'\\'
(1 row)
abacus_temp_qa=# show standard_conforming_strings ;
standard_conforming_strings
-----------------------------
off
// Databaser is implemented by pgx.ConnPool, pgx.Conn and pgx.Tx
// model.XODB is a subset of global.Database
type Databaser interface {
Exec(string, ...interface{}) (pgx.CommandTag, error)
Query(sql string, args ...interface{}) (*pgx.Rows, error)
QueryRow(sql string, args ...interface{}) *pgx.Row
Prepare(name, sql string) (*pgx.PreparedStatement, error)
}
// Txer is implemented by pgx.ConnPool and pgx.Conn
type MyJsonName struct {
Buy float64 `json:"buy"`
High float64 `json:"high"`
Last float64 `json:"last"`
Low float64 `json:"low"`
Sell float64 `json:"sell"`
Vol int `json:"vol"`
Volume int `json:"volume"`
}
-- -*-sql-*-
drop table holidays;
begin;
create table holidays (
day date not null,
name text not null
) without oids;
-- Using text, for ease of working with:
CREATE TABLE file_hash (
hash_id integer PRIMARY KEY,
file_id integer REFERENCES file,
md5 text UNIQUE,
sha1 text UNIQUE,
photodna text UNIQUE
);
package model
import (
"database/sql/driver"
"encoding/json"
"errors"
"net"
)
//go:generate bash makemodel.sh
#!/usr/bin/perl
use DBI;
use Net::DNS;
my @slaves = ('216.189.157.158');
my $cmd = $ARGV[0];
if($cmd eq 'deploy_challenge') {