Skip to content

Instantly share code, notes, and snippets.

View Ovid's full-sized avatar

Ovid Ovid

View GitHub Profile
@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;
@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 / 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 / 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 / limit.p6
Created February 9, 2016 09:25
Perl 6 Rats throw an exception when trying to get too precise?
# per https://perso.ens-lyon.fr/jean-michel.muller/chapitre1.pdf (page 8), the
# following should approach the limit of 6, but all floating point implementations
# go crazy and approach a limit of 100. I wrote it in Perl 6 using Real and sure enough,
# it approaches 6 before going crazy and approaching 100. But when I switch from Real to
# Rat, I get "Type check failed in assignment to $w; expected Rat but got Num" after
# 25 iterations
# This is Rakudo version 2015.12-307-gd68c304 built on MoarVM version 2016.01
# implementing Perl 6.c.
# https://perso.ens-lyon.fr/jean-michel.muller/chapitre1.pdf
@Ovid
Ovid / git-show-authors.pl
Last active November 21, 2016 08:48
A little Perl script to make it easier to track down git branches
#!/usr/bin/env perl
use 5.24.0;
use warnings;
use Term::ANSIColor;
chomp( my @branches
= qx/git show -s --pretty='%cn|%ci %D' \$(git rev-parse --branches --remotes)/
);
my %branches_for;
@Ovid
Ovid / newton.go
Last active December 21, 2016 16:28
Newton's methods for calculating the square root in golang
package main
// newton's method for calculating square roots
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
@Ovid
Ovid / exercise-rot-reader.go
Created December 23, 2016 10:47
Rot13 in golang (exercise from tour)
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
reader io.Reader
@Ovid
Ovid / tweets.pl
Last active January 6, 2017 09:12
Multi-line tweets from the command line
#!/usr/bin/env perl
use Modern::Perl;
use Net::Twitter;
use Config::Tiny;
use File::HomeDir;
use utf8::all;
use Text::Wrap;
use Term::ANSIColor;
use autodie ':all';
@Ovid
Ovid / .perldb
Last active July 5, 2022 15:50
My debugger file
package Ovids::Debugger;
# vim: syntax=perl
=head1 NAME
.perldb - Customize your Perl debugger
=head1 USAGE