Skip to content

Instantly share code, notes, and snippets.

View TheRayTracer's full-sized avatar

Simon Flannery TheRayTracer

  • Melbourne, Australia
View GitHub Profile
@TheRayTracer
TheRayTracer / activity1.png
Last active December 11, 2019 03:40
Basic example of a 555 timer flashing led circuit from first principles. Source is from a 5V USB adaptor.
activity1.png
@TheRayTracer
TheRayTracer / SSD1351.py
Last active August 3, 2019 23:59
The below Python source files implement an OLED display driver for the SSD1351 chipset using the SPI interface. The source code provides an interactive example – the classic Snake game that minimise screen redraw and makes use of the Curses library.
import struct
import spidev
import sys
import time
import random
import RPi.GPIO as gpio
ascii = [
[ 0x55, 0x00, 0x55, 0x00, 0x55 ],
[ 0x55, 0x00, 0x55, 0x00, 0x55 ],
@TheRayTracer
TheRayTracer / bitcoin_bip_0039.py
Created April 7, 2018 21:22
Custom implementation of BIP 39.
import sys
import binascii
import hashlib
import random
import hmac
import pbkdf2
PBKDF2_ROUNDS = 2048
# Custom implementation of BIP 39: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
@TheRayTracer
TheRayTracer / plot_a.png
Last active August 11, 2017 09:54
This is a model for the Titanic Kaggle tutorial. Score was 0.79426.
plot_a.png
@TheRayTracer
TheRayTracer / MTK3339.py
Last active December 5, 2018 19:40
A simple snippet of Python to parse a few NMEA sentences read from a MTK3339 device on a Raspberry Pi v3.
import serial #sudo apt-get install python-serial
import time
import RPi.GPIO as gpio
PMTK_ACK = '$PMTK001'
PMTK_INVALID = '0'
PMTK_UNSUPPORTED = '1'
PMTK_VALID_FAILED = '2'
PMTK_VALID_SUCCESS = '3'
@TheRayTracer
TheRayTracer / bitcoin_address_generator.py
Created August 18, 2016 11:35
This is a reference implementation for generating an offline Bitcoin address.
import sys
import re
import binascii
import ecdsa
import hashlib
# import random
import Crypto.Random.random as rand
b58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
@TheRayTracer
TheRayTracer / MAX7219.py
Last active January 12, 2019 08:43
This addition helps to drive a MAX7219 chipset for controlling Seven Segement displays and 8x8 led matrices. See the wiring diagram for connection to a Raspberry Pi.
import time
import math
import spidev
import RPi.GPIO as gpio
NO_OP = 0x0
REG_DIGIT0 = 0x1
REG_DIGIT1 = 0x2
REG_DIGIT2 = 0x3
REG_DIGIT3 = 0x4
@TheRayTracer
TheRayTracer / mushrooms_explore_a.png
Last active October 6, 2022 20:30
Using R to explore the UCI mushroom dataset reveals excellent KNN prediction results.
mushrooms_explore_a.png
@TheRayTracer
TheRayTracer / SSD1331.py
Last active March 12, 2020 13:18
The below Python source files control an OLED display (size 96 x 64, 65K colours) using a SSD1331 chipset and the SPI interface. The source code initialises the chipset and includes hardware accelerated functions for drawing primitive shapes and a non-hardware accelerated full ASCII set. Examples include a basic Space Invaders game, and a clock.
import struct
import spidev
import sys
import time
import random
import RPi.GPIO as gpio
ascii = [
[ 0x55, 0x00, 0x55, 0x00, 0x55 ],
[ 0x55, 0x00, 0x55, 0x00, 0x55 ],
@TheRayTracer
TheRayTracer / SSD1306.py
Last active August 4, 2019 00:03
The below Python source controls an OLED display (size 128 x 64) using a SSD1306 chipset and the SPI interface. The source code initialises the chipset setting the 2 orange pages at the top of the display, and includes functions for drawing primitive shapes and a full ASCII set.
import struct
import spidev
import sys
import time
import random
import RPi.GPIO as gpio
ascii = [
[ 0x55, 0x00, 0x55, 0x00, 0x55 ],
[ 0x55, 0x00, 0x55, 0x00, 0x55 ],