Skip to content

Instantly share code, notes, and snippets.

View alexlovelltroy's full-sized avatar
🏫
Attending Marcel Marceau College of Radio Performance

Alex Lovell-Troy alexlovelltroy

🏫
Attending Marcel Marceau College of Radio Performance
View GitHub Profile
@alexlovelltroy
alexlovelltroy / .bashrc
Last active April 18, 2024 10:28
Protable dotfiles
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
@alexlovelltroy
alexlovelltroy / Vagrantfile
Last active April 17, 2024 16:46
OpenCHAMI development vagrantfile
$script = <<SCRIPT
# Refresh the packages and install the necessary ones
dnf config-manager --set-enabled crb
dnf install -y epel-release && dnf update --refresh -y
dnf install -y dkms kernel-devel kernel-headers gcc make bzip2 perl elfutils-libelf-devel vim-enhanced git clang jq telnet
dnf groupinstall -y 'Development Tools'
# Install a modern version of the go programming language
curl -LO https://go.dev/dl/go1.21.9.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.21.9.linux-amd64.tar.gz
@alexlovelltroy
alexlovelltroy / mirror_repos.sh
Created May 7, 2023 04:10
Mirror a set of packages from public repositories to a new private ECR
#!/bin/bash
# Define the containers you want to mirror from Docker Hub to ECR
containers=(\
"confluentinc/cp-zookeeper:6.1.11"\
"confluentinc/cp-kafka:6.1.11"\
"minio/mc:RELEASE.2023-04-12T02-21-51Z" \
"hashicorp/vault:1.13" \
"postgres:11-alpine" \
"alpine:3.16" \
@alexlovelltroy
alexlovelltroy / latest_gh_releases.sh
Created May 15, 2021 14:53
Bash script for retrieving the latest released versions of all the stuff I star on github
#!/bin/bash
GH_USER=${1-$USER}
REPOS=`curl -s https://api.github.com/users/$GH_USER/starred |grep full_name | cut -f 4 -d\" |xargs`
for REPO in $REPOS; do
VERSION=`curl -s https://api.github.com/repos/$REPO/releases |grep tag_name |grep -v rc | head -1 |cut -f4 -d\"`
echo "$REPO : $VERSION"
done
@alexlovelltroy
alexlovelltroy / index.js
Created June 16, 2020 09:18
Cloudflare Worker Mnemonic-as-a-Service
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
var wordlist = ["acrobat", "africa", "alaska", "albert", "albino", "album",
"alcohol", "alex", "alpha", "amadeus", "amanda", "amazon",
"america", "analog", "animal", "antenna", "antonio", "apollo",
"april", "aroma", "artist", "aspirin", "athlete", "atlas",
"banana", "bandit", "banjo", "bikini", "bingo", "bonus",
"camera", "canada", "carbon", "casino", "catalog", "cinema",
@alexlovelltroy
alexlovelltroy / DaemonSet.yaml
Last active May 6, 2019 20:33
DaemonSet for controling the light rings on NUCs. Kubernetes running on debian stretch
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: nuc-light-control
spec:
selector:
matchLabels:
name: nuc-light-control
template:
metadata:
from debian:stretch-slim as builder
RUN apt-get -y update
RUN apt-get -y install build-essential linux-headers-$(uname -r)
RUN apt-get -y install debhelper dkms kmod unzip
RUN curl -LO https://github.com/milesp20/intel_nuc_led/archive/master.zip && unzip master.zip
RUN cd intel_nuc_led-master && make clean && make dkms-install
from alpine as base
RUN apk update --no-cache && apk add kmod --no-cache
@alexlovelltroy
alexlovelltroy / create_vms.sh
Created February 21, 2019 16:11
Create, Load, and Start a bunch of simple firecracker vms
#!/bin/bash
echo "Bash version ${BASH_VERSION}..."
FIRECRACKER_BIN=/usr/bin/firecracker
JAILER_BIN=/usr/bin/jailer
echo -n "Jailer version "
$JAILER_BIN -V
echo -n "Firecracker version "
@alexlovelltroy
alexlovelltroy / reformat_json.py
Created September 6, 2018 14:13
Given a son file, reformat it as one data element per line
#!/usr/bin/env python3
import json
import sys
if __name__ == "__main__":
program_name = sys.argv[0]
arguments = sys.argv[1:]
count = len(arguments)
@alexlovelltroy
alexlovelltroy / create_gcp_data_project.sh
Created September 6, 2018 08:51
Bash snippet I use to create a temporary GCP project for doing datalab stuff
#!/usr/bin/bash
set -e
PROJECT_SUFFIX=$(cat /dev/random | LC_CTYPE=C tr -dc "a-z0-9" | head -c 5)
PROJECT_NAME=temp-project-$PROJECT_SUFFIX
PROJECT_BUCKET=data_export_bucket-$PROJECT_SUFFIX
# Update gcloud