Skip to content

Instantly share code, notes, and snippets.

View geekscape's full-sized avatar

Andy Gelme geekscape

View GitHub Profile
@geekscape
geekscape / docker_image_purge.sh
Created June 18, 2024 05:25
Bash script to remove Docker Images using a whitelist and keeping a specified number of copies ... beyond what "docker system prune" does
#!/bin/bash
#
# Usage
# ~~~~~
# docker_image_purge list
# docker_image_purge [ remove ]
#
# By default, this command only shows what Docker images it'll remove.
# Use the optional "remove" command line parameter to actually remove them !
#
#!/usr/bin/env python3
#
# Installation
# ~~~~~~~~~~~~
# workon work3.9
#
# brew install ffmpeg
# pip install ffmpeg # For "import pydub"
# pip install matplotlib==3.3.3 # Prevent "Segmentation: 11" fault
# pip install numpy
@geekscape
geekscape / 1_debug_me.py
Last active January 7, 2023 00:48
Python debugging example
#!/usr/bin/env python3
def a(a1, a2):
a1 = a1 - 1
# breakpoint()
result = b(a1, a2)
return result
def b(b1, b2):
b2 = b2 - 1
@geekscape
geekscape / esp32_pinout.txt
Created November 19, 2022 00:09
ESP32 pin-out
Blog post: https://www.superhouse.tv/esp32-pin-allocation-spreadsheet
ESP-32 pin-out spreadsheet: https://docs.google.com/spreadsheets/d/1FsCiA50mrph4NE1i6BlBVi7fMLAUyI89ZtA_V55Rn-M/edit?usp=sharing
@geekscape
geekscape / templates_index.html
Last active November 5, 2022 00:05
Python web server example
<!DOCTYPE html>
<html>
<head>
<title>Hello World !</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script>
if (typeof DeviceOrientationEvent.requestPermission === 'function') {
@geekscape
geekscape / 1_mqtt_example.py
Last active October 15, 2022 00:40
Python MQTT example
#!/usr/bin/env python3
#
# https://tinyurl.com/gs-py-mqtt
# https://gist.github.com/geekscape/b227193c761c674db6c46d23f2428b78
#
# Eclipse Paho project
# - https://www.eclipse.org/paho
# Python MQTT client module
# - https://pypi.org/project/paho-mqtt
# pip install paho-mqtt
@geekscape
geekscape / _notes_python_serial.txt
Last active September 2, 2022 23:31
Python Serial examples for host and microController
This GitHub Gist can be reached by this short URL: https://tinyurl.com/gs-py-serial
Set-up Python virtual environment
- See https://pythonbasics.org/virtualenv
- Avoids changing operating system installed version of Python environment
Install Python serial module
$ pip install pyserial
Run Thonny IDE and use the Python virtual environment for your host system
@geekscape
geekscape / led_tile.ino
Last active January 9, 2017 01:25
Arduino WS2812B LED serial interface command interpreter
// c000011
// f
// c000000
// f
// c100000
// p0,2,4,6,9,11,13,15,16,18,20,22,25,27,29,31,32,34,36,38,41,43,45,47,48,50,52,54,57,59,61,63
// c001000
// p1,3,5,7,8,10,12,14,17,19,21,23,24,26,28,30,33,35,37,39,40,42,44,46,49,51,53,55,56,58,60,62
@geekscape
geekscape / camera_grab_video.py
Created July 31, 2016 08:04
Morse robot simulator example
#!/Users/andyg/.virtualenvs/cv3/bin/python3
# Requires OpenCV 3.0.0 for GStreamer / cv2.VideoCapture() integration
# workon cv
#
# pip3 install scipy
# pip3 install pillow # provides PIL
import base64
import cv2
import numpy
@geekscape
geekscape / history_macosx_morse_install.txt
Created July 31, 2016 01:16
Mac OS X /History: Install Morse (robot simulator)
Wed 27 Jul 2016 21:33:05 AEST [andyg]
Install morse (robot simulator)
- See https://github.com/morse-simulator/morse
- See http://www.openrobots.org/morse/doc/stable/morse.html
- See http://www.openrobots.org/morse/doc/latest/user/installation.html
- See https://en.wikipedia.org/wiki/Robotics_simulator
brew switch python3 3.5.1 # for Blender
# brew switch python3 3.5.2 # back to normal !