Skip to content

Instantly share code, notes, and snippets.

View mlbright's full-sized avatar

Martin-Louis Bright mlbright

  • Toronto
  • 02:04 (UTC -04:00)
View GitHub Profile
package main
import (
"fmt"
"os"
"os/exec"
"strings"
"unicode"
"mvdan.cc/sh/v3/syntax"
#!/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" );
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 04:07
List all installed perl modules
#! /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 January 17, 2018 16:40
Compare golang's filepath.Split and filepath.Dir
package main
import (
"fmt"
"path/filepath"
)
func main() {
paths := []string{
"/home/arnie/amelia.jpg",
{
repository(name: "darksky", owner: "mlbright") {
ref(qualifiedName: "refs/heads/master") {
target {
... on Commit {
tree {
id
entries {
oid
name
{
repository(name: "darksky", owner: "mlbright") {
ref(qualifiedName: "master") {
target {
... on Commit {
id
history(first: 5) {
pageInfo {
hasNextPage
}
#!/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 / slidingwindowmap.py
Created September 5, 2012 03:35
Solution to the SlidingWindowMap coding challenge by Cedric Beust
# solution to http://beust.com/weblog/2012/09/02/coding-challenge-a-sliding-window-map/
import heapq
import time
class SlidingWindowMap(object):
def __init__(self,api_keys,max_count,period_minutes):
self.period = period_minutes * 60
self.pq = []
for api_key in api_keys:
@mlbright
mlbright / search
Last active March 7, 2017 05:02
possible trees