Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
New Glasses. Who dis?

Alex Lovell-Troy alexlovelltroy

💭
New Glasses. Who dis?
View GitHub Profile
@alexlovelltroy
alexlovelltroy / index.js
Created Jun 16, 2020
Cloudflare Worker Mnemonic-as-a-Service
View index.js
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
DaemonSet for controling the light rings on NUCs. Kubernetes running on debian stretch
View DaemonSet.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: nuc-light-control
spec:
selector:
matchLabels:
name: nuc-light-control
template:
metadata:
View Dockerfile
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 Feb 21, 2019
Create, Load, and Start a bunch of simple firecracker vms
View create_vms.sh
#!/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 Sep 6, 2018
Given a son file, reformat it as one data element per line
View reformat_json.py
#!/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 Sep 6, 2018
Bash snippet I use to create a temporary GCP project for doing datalab stuff
View create_gcp_data_project.sh
#!/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
@alexlovelltroy
alexlovelltroy / flap_nginx.py
Last active Aug 30, 2016
Python can reload the nginx config file faster than I can write a new one
View flap_nginx.py
#!/usr/bin/env python
import time
import psutil
import os
import signal
@alexlovelltroy
alexlovelltroy / pre-commit
Created Sep 24, 2015
A very simple pre-commit hook for continuous docker build
View pre-commit
#!/bin/bash
# Add this locally to your repo as .git/hooks/pre-commit and make sure it is executable
# This does not actually get synced when you push to remote
docker build -t "hello_world" . && docker images hello_world && echo "Docker built properly"
View wonderfuler.sh
# install cowsay and fortune
sudo apt-get install cowsay fortune
# install lolcat
sudo gem install lolcat
# be more wonderful
fortune |cowsay|lolcat
@alexlovelltroy
alexlovelltroy / custom.json
Created Apr 18, 2015
geoip and statsd example
View custom.json
"logstash": {
"version": "1.4.4",
"server": {
"enabled": true,
"inputs": [
{
"rabbitmq": {
"exchange": "logstash",
"user": "username",
"password": "password",
You can’t perform that action at this time.