Skip to content

Instantly share code, notes, and snippets.

💭
New Glasses. Who dis?

Alex Lovell-Troy alexlovelltroy

💭
New Glasses. Who dis?
Block or report user

Report or block alexlovelltroy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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",
View test.rb
# use this file to run chef locally on an opsworks instance
# You'll need to put it in /opt/aws/opsworks/current <-- it should contain a bin/ subdir
# to use it, find reasonable paths for substitution and call your recipe like this:
# bin/chef-solo -o <cookbook>::<recipe> -c test.rb -j /var/lib/aws/opsworks/chef/<date>.json -l info
# The next line is the only thing you really need in this file. The rest is documentation
cookbook_path ["/opt/aws/opsworks/current/merged-cookbooks"]
You can’t perform that action at this time.