Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Gadgetoid's full-sized avatar
🚼
+1 Baby

Philip Howard Gadgetoid

🚼
+1 Baby
View GitHub Profile
@Gadgetoid
Gadgetoid / README.md
Last active February 20, 2023 09:35
Raspberry Pi Zero / Windows 10 automatic RNDIS driver install for composite gadgets

Preface

I owe my very rapid learning journey in the world of ConfigFs to several key sources which aren't necessarily relevant to this result, but I feel deserve a mention anyway.

@Gadgetoid
Gadgetoid / __init__.py
Created July 7, 2017 09:47
Unicorn HAT HD - Dual Unicorn HAT
#!/usr/bin/env python
# NOTE! This file replaces __init__.py in the Unicorn HAT HD library and allows it to drive two displays side-by-side,
# in this configuration: https://twitter.com/Gadgetoid/status/883259931478155264
# Both HATs are connected to Mini Black HAT Hack3r boards- the right board is connected directly to the Pi, and the left
# board is wired to the GPIO outputs of the right using the standard UHHD pinout: https://pinout.xyz/pinout/unicorn_hat_hd
# MISO is not needed, and the chip-select pin is jumped from BCM7 on the right header to BCM8 on the left.
@Gadgetoid
Gadgetoid / README.md
Last active September 4, 2019 17:23
VLC PHATBEAT Pirate Radio

Starting from Jessie or Jessie Lite

curl get.pimoroni.com/phatbeat | bash

Then install VLC:

sudo apt-get install vlc-nox
@Gadgetoid
Gadgetoid / asound.md
Last active August 21, 2020 15:02
Working asound.conf for libphatmeter on Volumio. Very hacky and still needs tweaks to mpd.conf and /dev/i2c-1 owned by group "audio" =/

This is a horrible, hacky, proof of concept mess for Pi VU Meter on Volumio It details steps with the old phatmeter library, but should work with PiVuMeter too, simply change "ameter" to "pivumeter" and link the right lib accordingly

udev rules permissions

REQUIRED: Create /etc/udev/rules.d/60-i2c.rules with the contents:

KEREL=="i2c-1", GROUP="i2C", MODE="0777"
from blinkt import set_pixel, clear, show
from time import localtime, sleep
MODE_HOUR = 0
MODE_MIN = 1
MODE_SEC = 2
time_to_stay_in_mode = 3
time_in_mode = 0
mode = 0
@Gadgetoid
Gadgetoid / parse-date-time-or-datetime.py
Last active September 16, 2017 09:28
Comprehensive Python example to count down to a date, time or datetime
import argparse
import datetime
import time
import sys
import os
console_rows, console_columns = [int(x) for x in os.popen('stty size', 'r').read().split()]
output_method = None
@Gadgetoid
Gadgetoid / pyruby.pb
Last active March 12, 2016 23:10
Absurdly fudgetastic method of including Python and Ruby in the same file. Will certainly break!
#!/usr/bin/env ruby
x=x\
=begin = 1
print("Hello World, I'm Python!")
'''
=end
@Gadgetoid
Gadgetoid / stsmakey.py
Created January 30, 2016 11:42
Makey Makey, Explorer HAT Pro and STS-Pi together in perfect harmony
#!/usr/bin/env python
"""
You will need:
* Explorer HAT Pro
* Makey Makey
* STS-Pi
* A USB battery
Note: You will probably need to grab the latest pyusb from GitHub to make this work:
@Gadgetoid
Gadgetoid / gist:319ecf8e3c5d3660e298
Created December 26, 2015 11:39
Static IP raspbian jessie USB gadget
# In /etc/network/interfaces
iface usb0 inet static
dns-nameservers 8.8.8.8 8.8.4.4
address 10.0.16.16
netmask 255.255.0.0
gateway 10.0.16.32
# In /etc/dhcpcd.conf
import explorerhat
import time
steps = [0 for x in range(16)]
G_FORWARDS = 2
G_BACKWARDS = 3
G_LEFT = 1
G_RIGHT = 4
G_PLAY = 5