Skip to content

Instantly share code, notes, and snippets.

View rasschaert's full-sized avatar

Kenny Rasschaert rasschaert

View GitHub Profile
@rasschaert
rasschaert / README.md
Last active December 17, 2015 19:19
Cylon Centurion / KITT

Cylon Centurion / KITT in Arduino

About

This Arduino sketch controls a series of ten leds similar to the visor of a Cylon Centurion or Knight Rider's car, KITT. Pressing the button cycles through different speed settings.

Cylon KITT

@rasschaert
rasschaert / Vagrantfile
Last active December 19, 2015 11:19
An example Vagrantfile with settings I often use.
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
###############################################################################
# Base box #
###############################################################################
config.vm.box = "chef/centos-6.5"
@rasschaert
rasschaert / nsq-0.2.24.linux-amd64.go1.2.tar.gz-to-rpm.bash
Last active January 3, 2016 12:39
Creates an RPM package for NSQ (distributed messaging platform written in Golang). Tested on CentOS 6 x86_64 with EPEL and Golang 1.2.
#!/bin/bash
echo 'Downloading pre-built binaries'
wget https://s3.amazonaws.com/bitly-downloads/nsq/nsq-0.2.24.linux-amd64.go1.2.tar.gz
echo 'Extracting archive'
tar xzf nsq-0.2.24.linux-amd64.go1.2.tar.gz
echo 'Creating correct directory structure'
mkdir -p nsq-0.2.24.linux-amd64.go1.2/usr/local/
mv nsq-0.2.24.linux-amd64.go1.2/{bin,share} nsq-0.2.24.linux-amd64.go1.2/usr/local/
@rasschaert
rasschaert / sublime_text_3_build_3059_x64.tar.bz2-to-rpm.bash
Last active January 3, 2016 19:29
Creates an RPM package for Sublime Text 3 beta
#!/bin/bash
echo "Creating directory structure"
mkdir -p ./tmproot/usr/bin
mkdir -p ./tmproot/usr/share/applications
mkdir -p ./tmproot/usr/share/icons/hicolor
mkdir -p ./tmproot/usr/share/icons/gnome
mkdir -p ./tmproot/opt/
echo "Downloading archive"
cd ./tmproot/opt
@rasschaert
rasschaert / id_rsa.pub
Last active May 11, 2018 08:52
SSH public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC19TqKl998IFqVt6RP4mTsVTX0qP95yBUnbX1/Cfm33YgPulRyju3Q0tfajTi47yvKgTgniLoFpev4YySGiXBZ0NECCLITISoarakcqITBiY73R+F+aaw0mHx6FM9mQSAvqmEP/Vvg6UGiSUMDKxfKZPhzlbzaJO0ch00RyVgfW8CfHkL0PeUA2qFFb24nvcnqmhNeVGer0ze/NsndnvztgOp01ql6PnEES4589AgQ7y3AgwOIHz8YGr+EdAQzSsglt3cxco1wj8k7JRB+I6uIb3pcV0Y8R6kTYqdJD7QmkqOMzWZNsy+rHBzLrudZ1Wu/7eP8JBbMuVVs+5i8gU93 kenny 20180423
@rasschaert
rasschaert / Avengrant.bash
Last active February 8, 2019 15:42
Some superhero-themed bash functions for making interaction with Vagrant more fun. Just place these in your ~/.bashrc
# Alternative to vagrant destroy
# Example usage: $> hulk smash -f vm1
hulk() {
if [[ $1 == "smash" ]]; then
shift
vagrant destroy $@
fi
}
# When you use caps, -f is implied
# Example usage: $> HULK SMASH
#!/bin/bash
# This script wraps around ssmtp. It makes a bit easier for me to send emails from cron.
# How to use this script:
# send-email.sh --subject="hello world" --body_file="/path/to/file.txt" --email="kenny@example.com"
# Set PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
function fail() {
@rasschaert
rasschaert / live_docker_health_check.sh
Created April 9, 2018 10:06
Live Docker health check
# If you have a healthcheck defined in your Dockerfile
#
# HEALTHCHECK --interval=5s --timeout=4s --start-period=10s CMD-SHELL pg_isready -U postgres -t 0 || exit 1
#
# or in your docker-compose.yml
#
# healthcheck:
# test: ["CMD-SHELL", "pg_isready -U postgres -t 0 || exit 1"]
# timeout: 4s
# interval: 5s
@rasschaert
rasschaert / follow
Created December 1, 2015 16:31
tail -f for a web page (I use it for following Bamboo build logs)
#!/bin/bash
command="curl -s $1 2>/dev/null"
prev_output=$(eval "$command")
echo "$prev_output"
while :; do
curr_output=$(eval "$command")
curr_wc=$(echo "$curr_output" | wc -l)
prev_wc=$(echo "$prev_output" | wc -l)
wc_diff=$((curr_wc - prev_wc))
@rasschaert
rasschaert / ssh-copy-all
Created December 1, 2015 16:30
script that copies over rmate to a host and creates a wrapper called rsub
#!/bin/bash
if [[ -z $1 ]]; then
echo "Usage: $(basename $0) HOSTNAME" >&2
exit 1
fi
ssh-copy-id $@
ssh-copy-rsub $@