Skip to content

Instantly share code, notes, and snippets.

View schrodervictor's full-sized avatar
🖖
Live long and prosper.

Victor Schröder schrodervictor

🖖
Live long and prosper.
View GitHub Profile
@schrodervictor
schrodervictor / uncamelize.js
Last active August 6, 2019 14:52 — forked from jpetitcolas/uncamelize.js
How to uncamelize a string in Javascript? Example: "HelloWorld" --> "hello_world"
/**
* Uncamelize a string, joining the words by separator character.
*
* @param {string} text - Text to uncamelize
* @param {string} [separator='_'] - Word separator
* @returns {string} Uncamelized text
*/
function uncamelize(text, separator) {
// Assume separator is _ if no one has been provided.
if('undefined' === typeof separator) {
import argparse
from PIL import Image
parser = argparse.ArgumentParser()
parser.add_argument("inputfile", help="Path to the image file to convert")
parser.add_argument("-o", "--output", help="Path to output file with the C array, if not given the same filename as the input is used, with filetype .c", action="store_true")
parser.add_argument("-p", "--preview", help="Print the resulting image to the terminal", action="store_true")
parser.add_argument("-d", "--dither", help="Set flag to dither image in conversion from colour to BW, if applicable", action="store_true")
parser.add_argument("-s", "--small", help="Set flag if your OLED has a resolution of 128x32 instead of 128x64", action="store_true")
parser.add_argument("-x", "--width", help="Pixel width of your OLED", type=int)
@schrodervictor
schrodervictor / README.md
Created August 11, 2021 07:31 — forked from manuelbl/README.md
ESP32 as Bluetooth Keyboard

ESP32 as Bluetooth Keyboard

With its built-in Bluetooth capabilities, the ESP32 can act as a Bluetooth keyboard. The below code is a minimal example of how to achieve it. It will generate the key strokes for a message whenever a button attached to the ESP32 is pressed.

For the example setup, a momentary button should be connected to pin 2 and to ground. Pin 2 will be configured as an input with pull-up.

In order to receive the message, add the ESP32 as a Bluetooth keyboard of your computer or mobile phone:

  1. Go to your computers/phones settings
  2. Ensure Bluetooth is turned on
@schrodervictor
schrodervictor / encryptedNixos.md
Created April 9, 2023 16:10 — forked from ladinu/encryptedNixos.md
NixOS install with encrypted /boot /root with single password unlock

Requirements

  1. Encrypt everthing including /boot and /root
  2. Enter password once
  3. Support UEFI

Installation media setup

Download NixOS minimal iso and copy to USB stick. For example on Mac OSX

$ diskutil list
$ diskutil unmountDisk /dev/disk1 # Make sure you got right device