Skip to content

Instantly share code, notes, and snippets.

View jeffa's full-sized avatar

Jeff Anderson jeffa

View GitHub Profile
@jeffa
jeffa / morse-to-midi.pl
Created April 30, 2024 14:29
Convert textual Morse Code into MIDI events
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
use MIDI;
use Text::Morse;
use Pod::Usage;
use Getopt::Long;
@jeffa
jeffa / ubuntu-boot1.sh
Last active April 20, 2024 17:18
Provision Ubuntu with system apps and set group
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 usermod -aG docker ubuntu
newgrp docker
@jeffa
jeffa / ubuntu-boot2.sh
Last active April 20, 2024 17:15
Provision Ubuntu with Docker and web app
wget https://github.com/jeffa/Sandbox-Spreadsheet/archive/refs/heads/master.zip
wget https://gist.githubusercontent.com/jeffa/78148e4197186b562e2985d620548ea1/raw/a001493ee921b14c23da8986ba075d7621b6e643/Dockerfile
unzip master.zip
mv Dockerfile Sandbox-Spreadsheet-master/
cd Sandbox-Spreadsheet-master/
docker pull perl:5.38
docker tag perl:5.38 myorg/perl:5.38
docker build -t myorg/myapp:dev .
docker run -d -p 80:3000 --name sandbox myorg/myapp:dev
@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
@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 / 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;