Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin-Louis Bright mlbright

View GitHub Profile
View commits-per-dir.pl
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw{ say };
use Getopt::Long;
my $options = {};
GetOptions( $options, "--directory=s", "--start=s", "--finish=s" );
View gist:3f5a64d457a5ba48be59f112c7e9889f
A BCDEFDG
AH I ECDDF
HDICJ
A BIKFDGLM
NODCAJDC
IHG GDMPQANDG
NOD CAEODQ
AH I HDICRS
EIJD
@mlbright
mlbright / perl-modules.pl
Created May 26, 2018
List all installed perl modules
View perl-modules.pl
#! /usr/bin/perl -l
use strict;
use warnings;
use File::Find;
my %seen;
for my $inc (@INC) {
next unless (-d $inc);
@mlbright
mlbright / filepath-examples.go
Created Jan 17, 2018
Compare golang's filepath.Split and filepath.Dir
View filepath-examples.go
package main
import (
"fmt"
"path/filepath"
)
func main() {
paths := []string{
"/home/arnie/amelia.jpg",
View graphql-tree
{
repository(name: "darksky", owner: "mlbright") {
ref(qualifiedName: "refs/heads/master") {
target {
... on Commit {
tree {
id
entries {
oid
name
View graphql-example
{
repository(name: "darksky", owner: "mlbright") {
ref(qualifiedName: "master") {
target {
... on Commit {
id
history(first: 5) {
pageInfo {
hasNextPage
}
View tips.pl
#!/usr/bin/perl
use strict;
use warnings;
my $days = 7;
my $nights = $days - 1;
my $bar = 2;
my $maid = 5;
my $alacarte = 5;
@mlbright
mlbright / search
Last active Mar 7, 2017
possible trees
View search
View async-get.pl
use Mojolicious::Lite;
# Search MetaCPAN for "mojolicious"
get '/' => sub {
my $c = shift;
$c->ua->get(
'api.metacpan.org/v0/module/_search?q=mojolicious' => sub {
my ( $ua, $tx ) = @_;
sleep(3);
$c->app->log->debug(
@mlbright
mlbright / talk.pl
Created Sep 17, 2015
Windows text to speech
View talk.pl
#!/usr/bin/env perl
use 5.018; # Why not?!
use Win32::OLE;
$Win32::OLE::Warn = 3;
my $speaker = Win32::OLE->new('SAPI.spvoice');
while (my $line = <DATA>) {