Skip to content

Instantly share code, notes, and snippets.

Ovid Ovid

Block or report user

Report or block Ovid

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Ovid
Ovid / date.pl
Created Aug 27, 2019
Partial desription of a date matching regex
View date.pl
#!/usr/bin/env perl
use Test::Most;
use Veure::Script; # strict, warnings, postderef, sigs, and more
use re 'eval'; # needed for (??{}) in the regex
# the (??{}) construct will execute code and consider the result of that
# to be a regex to match on.
my $yyyy_mm_dd = qr/
^
# any four digit year
View keybase.md

Keybase proof

I hereby claim:

  • I am ovid on github.
  • I am ovidperl (https://keybase.io/ovidperl) on keybase.
  • I have a public key ASDsbYunRavQwS2b6ZR7TER9LwNC4YtX7oDIqaGPu6URwAo

To claim this, I am signing this object:

@Ovid
Ovid / lrutest.p6
Last active Jul 24, 2018
Sample LRU cache in Perl 6?
View lrutest.p6
# Turns out this doesn't work because OrderedHash
# is sorted, not ordered
class Cache::LRU {
use OrderedHash;
has %.cache = {} does OrderedHash;
has UInt $.max_size = 20;
method get($key) {
return %.cache{$key};
}
View gist:a28f15da01f5b69a55779e42e7046766
#!/usr/bin/env perl
# This program constantly prints the time in GCT (Galactic Coordinated Time)
# as used in the MMORPG Tau Station (https://taustation.space/)
# Obviously, we use something a bit more sophisticated than this :)
use strict;
use warnings;
use Time::HiRes 'sleep';
$|++; # unbuffer STDOUT
View git-refresh.sh
#!/bin/bash
# vim: filetype=sh
set -e # exit if any command fails
prog=$(basename $0)
branch=$(git rev-parse --abbrev-ref HEAD)
need_to_stash=$(git status --porcelain -uno)
@Ovid
Ovid / livejournal.pl
Created Mar 28, 2017
Backup your old, dead LiveJournal entries
View livejournal.pl
#!/usr/bin/env perl
use 5.18.0;
use warnings;
use autodie ":all";
use LWP::UserAgent;
use HTTP::Request::Common;
use HTML::TokeParser::Simple;
my $login_url = 'https://www.livejournal.com/login.bml?ret=1';
@Ovid
Ovid / .perldb
Last active Mar 8, 2019
My debugger file
View .perldb
package Ovids::Debugger;
# vim: syntax=perl
=head1 NAME
.perldb - Customize your Perl debugger
=head1 USAGE
@Ovid
Ovid / tweets.pl
Last active Jan 6, 2017
Multi-line tweets from the command line
View tweets.pl
#!/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 / exercise-rot-reader.go
Created Dec 23, 2016
Rot13 in golang (exercise from tour)
View exercise-rot-reader.go
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
reader io.Reader
@Ovid
Ovid / newton.go
Last active Dec 21, 2016
Newton's methods for calculating the square root in golang
View newton.go
package main
// newton's method for calculating square roots
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
You can’t perform that action at this time.