Skip to content

Instantly share code, notes, and snippets.

View WayneKeenan's full-sized avatar

Wayne Keenan WayneKeenan

  • Eastbourne, UK
  • 15:45 (UTC +01:00)
View GitHub Profile
@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 (wayne.keenan@gmail.com)
#
# Deps:
# 1) MeArm should have the MeArm_BLE sketch programmed, found here: https://codebender.cc/sketch:244546
# 2) Adafruit Python BLE libray (see below)
#
<!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
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
@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:
@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 / 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()
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 / 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
@WayneKeenan
WayneKeenan / mac-vagrant-howto.rst
Created October 22, 2017 12:51 — forked from tbonesteaks/mac-vagrant-howto.rst
brew, vagrant, virtualbox, and vagrant file howto...

Vagrant on Mac w Virtualbox

NSoT engineers have built Vagrantfiles for you to deploy NSoT software in a multitude of linux environments. This tutorial will help you load a Macintonsh computer (OS X) with Vagrant, Virtual Box, and dependencies so that you can start virtual servers and test the software.

NSoT publishes complete installation instructions for linux distributions, branch versions, and Vagrantfiles in addition to, not an alternative for the pip install method:

$ pip-install nsot
@WayneKeenan
WayneKeenan / main.py
Last active November 2, 2017 05:11
PiCraftZero test script, demoing self install of its 2 dependancies for PiratePython
#!/usr/bin/env python3
import pip
pip.main(['install', 'gpiozero'])
pip.main(['install', 'picraftzero']) # Joypad and Web Remote controls with multiple camera support, please see
# https://github.com/WayneKeenan/picraftzero
from picraftzero import Joystick, Wheelbase, steering_mixer, start
# Joystick axis range is: (left/down) -100 .. 100 (right/up)