Skip to content

Instantly share code, notes, and snippets.

View Ovid's full-sized avatar

Ovid Ovid

View GitHub Profile
@Ovid
Ovid / db-shell.p6
Last active January 22, 2016 16:10
A naïve db client in Perl 6
# a rewrite of http://blogs.perl.org/users/ovid/2016/01/a-naive-sql-shell.html in Perl 6
use v6;
use DBIish;
use Linenoise;
use Text::Table::Simple;
my constant HIST-FILE = '.myhist';
my constant HIST-LEN = 100;
my constant ROW-LIMIT = 100;
@Ovid
Ovid / db-shell.pl
Last active January 22, 2016 10:04
A Naïve SQL Client
#!/usr/bin/env perl
use warnings;
use 5.18.0;
use Term::ReadLine;
use Term::ReadKey;
use Try::Tiny;
use Text::Table;
use Term::ANSIColor;
use DBI;
@Ovid
Ovid / colorize
Created November 21, 2015 11:15
A program that can tremendously speed up Perl debugger syntax highlighting
#!/usr/bin/env perl
# vim: filetype=perl
use 5.18.0;
use lib qw{lib t/lib t/tests};
use warnings;
use autodie ':all';
use Capture::Tiny 'capture';
use Perl6::Junction 'any';
@Ovid
Ovid / sqitch.t
Created July 13, 2015 21:51
Testing Your Sqitch Changes
#!/usr/bin/env perl
use autodie ':all';
use Test::Most;
use FindBin;
use Veure::Config 'config';
use File::Spec::Functions 'catfile';
use Capture::Tiny 'capture';
bail_on_fail;

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@Ovid
Ovid / gist:0674ef8fe906f10cc8f2
Created July 5, 2014 18:43
Procedural quest generation
#!/usr/bin/env perl
use 5.10.0;
use strict;
use warnings;
use Getopt::Long;
use Data::Dumper;
$Data::Dumper::Indent = 0;
$Data::Dumper::Terse = 1;
@Ovid
Ovid / vawa.vim
Created May 16, 2014 15:30
Perl Vim Variable highlighting
" Drop this into .vim/plugin.vawa.vim
" if you already have vawa.vim, rename appropriately
" automatically highlights variables under cursor, allowing you to easily see the data flow.
" Vawa Plugin for VIM > 7.3 version 1.00
" Maintainer: Sandeep.c.r<[email protected]>
" Hacked for Perl by Curtis "Ovid" Poe <[email protected]>
function! s:vawa()
call clearmatches()
@Ovid
Ovid / gist:11038984
Last active August 29, 2015 14:00
Fetching Email Threads in Veure
SELECT thread.*
FROM email thread
JOIN email selected ON selected.email_thread_id = thread.email_thread_id
JOIN character recipient ON recipient.character_id = thread.recipient_id
JOIN station_area sa ON sa.station_area_id = recipient.station_area_id
JOIN station st ON st.station_id = sa.station_id
JOIN star origin ON origin.star_id = thread.sender_star_id
JOIN star destination ON destination.star_id = st.star_id
LEFT JOIN route
ON ( route.from_id = origin.star_id AND route.to_id = destination.star_id )
@Ovid
Ovid / gist:4971602
Created February 17, 2013 14:00
Red-black tree output
8: [RedBlack::B, Any, 8, Any]
6: [RedBlack::B, [RedBlack::R, Any, 6, Any], 8, Any]
4: [RedBlack::B, [RedBlack::B, Any, 4, Any], 6, [RedBlack::B, Any, 8, Any]]
7: [RedBlack::B, [RedBlack::B, Any, 4, Any], 6, [RedBlack::B, [RedBlack::R, Any, 7, Any], 8, Any]]
9: [RedBlack::B, [RedBlack::B, Any, 4, Any], 6, [RedBlack::B, [RedBlack::R, Any, 7, Any], 8, [RedBlack::R, Any, 9, Any]]]
3: [RedBlack::B, [RedBlack::B, [RedBlack::R, Any, 3, Any], 4, Any], 6, [RedBlack::B, [RedBlack::R, Any, 7, Any], 8, [RedBlack::R, Any, 9, Any]]]
2: [RedBlack::B, [RedBlack::R, [RedBlack::B, Any, 2, Any], 3, [RedBlack::B, Any, 4, Any]], 6, [RedBlack::B, [RedBlack::R, Any, 7, Any], 8, [RedBlack::R, Any, 9, Any]]]
1: [RedBlack::B, [RedBlack::R, [RedBlack::B, [RedBlack::R, Any, 1, Any], 2, Any], 3, [RedBlack::B, Any, 4, Any]], 6, [RedBlack::B, [RedBlack::R, Any, 7, Any], 8, [RedBlack::R, Any, 9, Any]]]
5: [RedBlack::B, [RedBlack::R, [RedBlack::B, [RedBlack::R, Any, 1, Any], 2, Any], 3, [RedBlack::B, Any, 4, [RedBlack::R, Any, 5, An
@Ovid
Ovid / gist:4971599
Created February 17, 2013 13:59
Reformatted for for red-black tree in Perl 6
enum RedBlack <R B>;
sub MAIN {
my $tree = Any;
for (1..10).pick(*) -> $node {
$tree = insert($node, $tree);
printf "%2d: %s\n", $node, $tree.perl;
}
}