Skip to content

Instantly share code, notes, and snippets.

View jeffa's full-sized avatar

Jeff Anderson jeffa

View GitHub Profile
@jeffa
jeffa / hello-world.sh
Last active July 2, 2024 21:14
Call me via wget -O - | bash with your name as an argument
#!/bin/sh
if [ -n "$1" ]; then
variable="$1"
elif [ -n "$HELLO_WORLD_VALUE" ]; then
variable="$HELLO_WORLD_VALUE"
else
variable="World"
fi
@jeffa
jeffa / build-project.sh
Created July 2, 2024 21:01
Builds Jenkins Project (Perl)
#!/usr/bin/sh
if [ -n "$1" ]; then
DIST="$1"
else
DIST="$CPAN_DISTRIBUTION"
fi
rm -f *.tar.gz
rm -rf ./$DIST
@jeffa
jeffa / jenkins-install.sh
Last active July 2, 2024 22:35
Install Java and Jenkins and Docker
#!/bin/sh
sudo apt update -y
sudo apt install openjdk-11-jre -y
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt update -y
@jeffa
jeffa / terraform-install.sh
Created June 30, 2024 13:34
Configures a provisioned VM with terraform
#!/bin/sh
# prevent interactive prompts
sudo sed -i "/#\$nrconf{restart} = 'i';/s/.*/\$nrconf{restart} = 'a';/" \
/etc/needrestart/needrestart.conf
cat /etc/needrestart/needrestart.conf | grep -i nrconf{restart}
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null
@jeffa
jeffa / docker-install.sh
Last active July 5, 2024 18:28
install Docker on Ubuntu 22.04
#!/bin/sh
# prevent interactive prompts
sudo sed -i "/#\$nrconf{restart} = 'i';/s/.*/\$nrconf{restart} = 'a';/" \
/etc/needrestart/needrestart.conf
cat /etc/needrestart/needrestart.conf | grep -i nrconf{restart}
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
@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