Skip to content

Instantly share code, notes, and snippets.

View jeffa's full-sized avatar

Jeff Anderson jeffa

View GitHub Profile
@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 / 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 / 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 / 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;
#!/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: [] }
#!/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
@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 );
@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 / ubuntu-boot.sh
Last active April 20, 2024 16:08
Provision AWS Ubuntu instance
sudo sed -i "/#\$nrconf{restart} = 'i';/s/.*/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf
sudo apt-get update -y
sudo apt-get install gcc -y
sudo apt-get install make -y
sudo apt-get install zip -y
sudo apt-get install docker.io -y
sudo apt-get install tree -y
#sudo adduser ubuntu docker
sudo usermod -aG docker ubuntu
newgrp docker
@jeffa
jeffa / Dockerfile
Last active April 20, 2024 15:51
Dockerfile for ubuntu-boot.sh
# docker build -t myorg/myapp:dev .
FROM myorg/perl:5.38
ADD . /app
WORKDIR /app
RUN cpanm --notest \
JSON Spreadsheet::Read HTML::TableExtract Imager::File::PNG \
Spreadsheet::ParseExcel Spreadsheet::Engine DBD::CSV Data::SpreadPagination \
YAML Dancer Template Text::CSV Spreadsheet::ParseXLSX \
DBIx::HTML Games::Sudoku::Component Text::FIGlet JavaScript::Minifier Encode::Wechsler
EXPOSE 3000