Skip to content

Instantly share code, notes, and snippets.

View WayneKeenan's full-sized avatar

Wayne Keenan WayneKeenan

  • Cambridge, UK
  • 21:20 (UTC +01:00)
View GitHub Profile
@WayneKeenan
WayneKeenan / virtualbox-vagrant-nuclear-option.sh
Created October 22, 2017 12:49 — forked from tjbenton/virtualbox-vagrant-nuclear-option.sh
Completely uninstall VirtualBox and Vagrant and reinstall through brew
# update brew because `brew update` is broken after updating to El Capitan
cd `brew --prefix`
git fetch origin
git reset --hard origin/master
sudo shutdown -r now # restart the computer
# open terminal and run the following
brew update
brew cleanup
import re
import json
import requests
from pprint import pformat
from time import sleep
from gpiozero import Energenie
lamp = Energenie(1)
QUERY_URL='https://www.govtrack.us/api/v2/role?current=true&role_type=president'
@WayneKeenan
WayneKeenan / pptx_test.py
Last active August 5, 2017 08:57
python-pptx slide creation test
from pptx import Presentation
# for adding shapes
from pptx.util import Inches
from pptx.enum.shapes import MSO_AUTO_SHAPE_TYPE
prs = Presentation()
@WayneKeenan
WayneKeenan / bluetooth_hci.py
Last active January 29, 2021 08:26
Bluetooth LE HCI Python test class
import socket
import fcntl
from ioctl_helper import _IOW, _IOR
import struct
import array
from subprocess import call
from time import sleep
from os import popen
# ---------------------------------------------------
@WayneKeenan
WayneKeenan / hci_ble_test.py
Last active March 28, 2020 00:14
Experimenting with Bluetooth LE HCI commands in Python
import socket
import fcntl
import struct
import array
# ---------------------------------------------------
# HCI Constants (https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/lib/hci.h)
# HCI ioctl Commands:
from inputs import devices, get_gamepad
print(devices.gamepads)
print(get_gamepad()) # the script will pause here until a joystick or button is pressed on the Gamepad
<!doctype html>
<html lang="en">
<!--
Pre-requisites:
Raspberry Pi 2 or 3: https://www.raspberrypi.org/
Raspberry Pi setup: TODO: Pi project will appear under https://github.com/TheBubbleWorks
@WayneKeenan
WayneKeenan / MeArm_BLE_Test.py
Last active February 17, 2016 10:01
MeArm Bluetooth LE Python example (low level)
#!/usr/bin/env python
#
# Description: Low level example of sending BLE messages to a MeArm Brain Board fitted with the HM-11 Bluetooth LE module
#
# 17/02/2016 Wayne Keenan ([email protected])
#
# Deps:
# 1) MeArm should have the MeArm_BLE sketch programmed, found here: https://codebender.cc/sketch:244546
# 2) Adafruit Python BLE libray (see below)
#