Skip to content

Instantly share code, notes, and snippets.


Stefan Kremser spacehuhn

View GitHub Profile
gojimmypi / Install_ESP32.bat
Created Dec 21, 2017
M5stack ESP32 Arduino IDE install
View Install_ESP32.bat
:: Arduino IDE 1.8.5
:: see
:: run as administrator
cd "C:\Program Files (x86)\Arduino\hardware"
mkdir espressif
cd espressif
git clone esp32
:: run get.exe

Guide to PROGMEM on ESP8266 and Arduino IDE


On low memory devices like the arduino and esp8266 you do not want strings to be stored in RAM. This occurs by default on these systems. Declare a string const char * xyz = "this is a string" and it will use up RAM.

The solution on these devices is to allow strings to be stored in read only memory, in Arduino this is the PROGMEM macro. Most of my experience is with the ESP8266 which is a 32bit micros controller. This device stores PROGMEM data in flash. The macro PROGMEM on ESP8266 is simply

heiswayi /
Created Feb 5, 2017
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
MightyPork / usb_hid_keys.h
Last active Aug 9, 2022
USB HID Keyboard scan codes
View usb_hid_keys.h
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
* Created by MightyPork, 2016
* Public domain
* Adapted from:
SeeJayDee / tiny_IRremote.cpp
Last active Sep 2, 2021
tiny_IRremote - Arduino IRremote ported to the ATtiny
View tiny_IRremote.cpp
* tiny_IRremote
* Version 0.2 July, 2016
* Christian D'Abrera
* Fixed what was originally rather broken code from
* ...itself based on work by Ken Shirriff.
* This code was tested for both sending and receiving IR on an ATtiny85 DIP-8 chip.
* IMPORTANT: IRsend only works from PB4 ("pin 4" according to Arduino). You will need to
* determine which physical pin this corresponds to for your chip, and connect your transmitter
gbaman /
Last active Aug 5, 2022
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

zachflower / rainbow.cpp
Last active May 7, 2021
Smooth RGB LED Color Transitions (Arduino)
View rainbow.cpp
int redPin = 11;
int greenPin = 10;
int bluePin = 9;
int r = 0;
int g = 0;
int b = 0;
void setup() {
pinMode(redPin, OUTPUT);
groovenectar / roundedcube.scad
Last active May 13, 2022
roundedcube.scad - Fork me and make me better!
View roundedcube.scad
// More information:
// Set to 0.01 for higher definition curves (renders slower)
$fs = 0.15;
module roundedcube(size = [1, 1, 1], center = false, radius = 0.5, apply_to = "all") {
// If single value, convert to [x, y, z] vector
size = (size[0] == undef) ? [size, size, size] : size;
translate_min = radius;