Skip to content

Instantly share code, notes, and snippets.

View jeffa's full-sized avatar

Jeff Anderson jeffa

View GitHub Profile
@jeffa
jeffa / ec2-boot.sh
Created April 20, 2024 00:29
Just a little script to bootstrap AWS EC2 instances
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
sudo yum -y install terraform
sudo yum -y install tree
sudo yum install -y docker
@jeffa
jeffa / pre-commit.pl
Last active February 13, 2017 20:39
Git pre-commit hook
#!/usr/bin/env perl
use strict;
use warnings;
use App::Prove;
my $app = App::Prove->new;
$app->process_args( @ARGV, '-l' );
exit( $app->run ? 0 : 1 );
#!/usr/bin/env ruby
limit = 2
key = 'none'
message = File.read( ARGV[0] )
tokens = message.split()
buckets = { 'what' => [], 'why' => [], key => [] }
tokens.each do |token|
t = token.downcase
#!/usr/bin/env python
import re, sys
limit = 2
key = 'none'
file = open( sys.argv[1], 'r' )
message = file.read()
tokens = message.split()
buckets = { 'what': [], 'why': [], key: [] }
@jeffa
jeffa / DBIx-Object.pm
Created October 21, 2015 21:16
ORM proof of concept
package DBIx::Object;
use base 'DBI';
package DBIx::Object::st;
use base 'DBI::st';
package DBIx::Object::db;
use base 'DBI::db';
use Moose;
@jeffa
jeffa / display
Created September 24, 2015 22:26
Display an image in your default browser.
alias display='perl -MHTML::Display -MCGI=img -MCwd=abs_path -e"display img{src=>abs_path(shift)}"'
@jeffa
jeffa / Tie-Scalar-OK.pm
Created May 21, 2015 01:51
Tie::Scalar::OK
package Tie::Scalar::OK;
use strict;
use base qw(Tie::Scalar);
use vars qw($VERSION);
$VERSION = '1.08';
sub TIESCALAR {
my $class = shift;
@jeffa
jeffa / purl
Created May 14, 2015 17:54
Download and execute Perlmonks raw scripts (at your own expense)
alias purl='__purl() { curl "$@" | perl; unset -f __purl; }; __purl'
@jeffa
jeffa / package-name2markdown-list.sh
Last active August 29, 2015 14:20
Generates list of MD linked package names
grep package t/lib/Test/Strategy/*.pm | perl -F'\s' -lape's/(:package|;)//for@F;$_=sprintf" * [%s](/%s)",reverse@F'
@jeffa
jeffa / auto-html.pl
Created May 4, 2015 18:46
Just another way to spit out HTML
package HTML::Auto;
use strict;
use warnings;
use Exporter 'import';
our @EXPORT = qw( html head title body h1 p br table Tr td );
our $AUTOLOAD;
sub new { bless {}, shift }
sub AUTOLOAD {
my $self = ref($_[0]) eq __PACKAGE__ ? shift : undef;
my $attr = ref($_[0]) eq 'HASH' ? shift : {};