Skip to content

Instantly share code, notes, and snippets.

View transilluminate's full-sized avatar

Adrian Robinson transilluminate

View GitHub Profile

Raspberry Pi Audio Visualiser

To play music at home, I use a Raspberry Pi and Shairport-sync to receive an Airplay stream and output via a pair of USB speakers.

I wanted to sample the audio stream, display an audio visualiser on the Display-o-Tron LCD display. Additionally I wanted to display the track info, which can be read from the metadata.

Using a bit of python magic, we can tie it all together...! Watch it all in action:

Raspberry Pi Visualiser

Selectively route specific IP addresses through VPN tunnel

This is a method for setting up an OpenVPN tunnel on a Raspberry Pi router device, which does not route all traffic via the VPN, but selective IP address within the LAN.

Note 1: also uses the amazing sqm-scripts for traffic shaping, to reduce bufferbloat as much as possible.

Note 2: eth0 is our internal LAN, wlan0 is our external WAN

  1. Allow packet forwarding (on reboot)
  • $ sudo nano /etc/sysctl.conf, uncomment this line:
@transilluminate
transilluminate / display.py
Created February 29, 2016 01:51
Raspberry Pi Display-O-Tron 3000 System Info Display
#!/usr/bin/env python
import time, colorsys, psutil, subprocess
import dot3k.lcd as lcd
import dot3k.backlight as backlight
from dot3k.menu import Menu, MenuOption
def run_cmd(cmd):
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output = p.communicate()[0].rstrip()