Skip to content

Instantly share code, notes, and snippets.

View theory's full-sized avatar
💭
🥃

David E. Wheeler theory

💭
🥃
View GitHub Profile
# Bricolage
alias btest="perl Makefile.PL; sudo make devtest TEST_VERBOSE=1 > $HOME/Desktop/bric_test.out 2>&1; tail -50 $HOME/Desktop/bric_test.out"
alias killa="sudo perl /usr/local/bricolage/bin/bric_apachectl stop"
alias kicka="sudo perl /usr/local/bricolage/bin/bric_apachectl restart"
alias starta="sudo perl /usr/local/bricolage/bin/bric_apachectl start"
alias build="/usr/local/bricolage/bin/bric_pgimport -u postgres -p postgres -d sharky -r -g castellan"
alias pbuilds="bbuild BRICOLAGE_HTTPD_VERSION=apache2 BRICOLAGE_DB_TYPE=Pg BRICOLAGE_SSL=1"
alias pbuilds1="bbuild BRICOLAGE_HTTPD_VERSION=apache BRICOLAGE_DB_TYPE=Pg BRICOLAGE_SSL=1"
alias mbuilds="bbuild BRICOLAGE_HTTPD_VERSION=apache2 BRICOLAGE_DB_TYPE=mysql BRICOLAGE_SSL=1"
alias mbuilds1="bbuild BRICOLAGE_HTTPD_VERSION=apache BRICOLAGE_DB_TYPE=mysql BRICOLAGE_SSL=1"
2001 ( 2) #
2002 ( 47) ###########################
2003 ( 45) ##########################
2004 ( 67) #######################################
2005 ( 44) #########################
2006 ( 43) #########################
2007 ( 7) ####
2008 ( 65) ######################################
2009 ( 26) ###############
2010 ( 33) ###################
use v5.12;
use warnings;
use utf8;
my $uname = 'theory';
my ($curr_month, $curr_year) = (gmtime)[4,5];
$curr_year += 1900;
$curr_month += 1;
my %projects;
for my $year (2012..$curr_year) {
# If two params, first is URI, second is target.
# If two params and either --to-target or --database is passed, it's an error.
# If one param:
# - If --to-target is passed, it's a database
# - If --database is passed, it's a target
# - If both --to-target and --database are passed, it's an error.
# - If contains ":", it's a URI; pass it through
# - If it is a database key name, return the URI value
# - If it's part of the plan, pass it as part of the plan.
# - Otherwise throw an exception.
$ /Library/Frameworks/Firebird.framework/Versions/A/Resources/bin/isql localhost:employee -User SYSDBA -password masterkey
Database: localhost:employee, User: SYSDBA
SQL> show version;
ISQL Version: UI-V2.5.2.26540 Firebird 2.5
Server version:
Firebird/Darwin/Intel64 (access method), version "UI-V2.5.2.26540 Firebird 2.5"
Firebird/Darwin/Intel64 (remote server), version "UI-V2.5.2.26540 Firebird 2.5/tcp (dwhee-ma-2944)/P12"
Firebird/Darwin/Intel64 (remote interface), version "UI-V2.5.2.26540 Firebird 2.5/tcp (dwhee-ma-2944)/P12"
on disk structure version 11.2
SQL> exit
@theory
theory / do_or_not_do
Last active December 19, 2015 05:59
A MySQL function that throws an error in a `SELECT` statement will have its error suppressed in a `DO` statement.
DELIMITER |
CREATE FUNCTION checkit(doit INTEGER, message VARCHAR(256)) RETURNS INTEGER
BEGIN
IF doit IS NULL OR doit = 0 THEN
SIGNAL SQLSTATE 'ERR0R' SET MESSAGE_TEXT = message;
END IF;
RETURN doit;
END;
|
diff --git a/src/semver.c b/src/semver.c
index f25e06e..c405135 100644
--- a/src/semver.c
+++ b/src/semver.c
@@ -49,6 +49,9 @@ typedef struct semver
char patchname[]; /* patch name, including the null byte for convenience */
} semver;
+#define DatumGetSemverP(x) ((semver *) PG_DETOAST_DATUM(x))
+#define PG_GETARG_SEMVER_P(n) DatumGetSemverP(PG_GETARG_DATUM(n))
<script async class="speakerdeck-embed" data-id="ad105ed0ac490130d6a626f5cde8fd08" data-ratio="1.2994923857868" src="//speakerdeck.com/assets/embed.js"></script>
dbd_preparse scanned 1 distinct placeholders
OCIHandleAlloc(7f9c69160200,7f9c698246d8,OCI_HTYPE_STMT,0,0)=SUCCESS
OCIStmtPrepare(7f9c69195010,7f9c69183df0,'
SELECT c.change_id
, COLLECT(t.tag) AS tags
FROM changes c
LEFT JOIN tags t ON c.change_id = t.change_id
WHERE c.project = :p1
GROUP BY c.change_id
',207,1,0)=SUCCESS
sub hurl {
@_ = (
__PACKAGE__,
previous_exception => $@,
ref $_[0] ? %{ $_[0] }
: @_ == 1 ? (message => $_[0])
: (ident => $_[0], message => $_[1])
);
goto __PACKAGE__->can('throw');
}