Skip to content

Instantly share code, notes, and snippets.

View harryjubb's full-sized avatar
🌴
I may be slow to respond.

Harry Jubb harryjubb

🌴
I may be slow to respond.
View GitHub Profile
@harryjubb
harryjubb / update_certificates.sh
Last active January 13, 2022 09:55
Generate TLS certificates with Let'sEncrypt using Cloudflare DNS validation
#!/usr/bin/env bash
# Create / update Let'sEncrypt certificates for a domain.
#
# Requires certbot with the dns_cloudflare plugin to be installed.
# https://eff-certbot.readthedocs.io/en/stable/install.html
#
# For example, on Ubuntu:
# https://certbot.eff.org/instructions?ws=other&os=ubuntufocal
# See the "Wildcard" tab.
@harryjubb
harryjubb / duckypad_autoswitch_osx_fix_branch.md
Last active December 1, 2021 16:27
Installing DuckyPad autoswitcher with Mac fixes

DuckyPad Mac autoswitcher fixes branch

Overview

The Duckypad autoswitcher seems to have some issues on OS X, where the autoswitcher will not switch profiles.

The issue seems to be that on Mac the autoswitcher keeps a long lived HID connection, and that OS X doesn’t get key presses from the pad while that connection is open. It could be that an OS X update changed how HID works, but is not clear.

There is a branch with some substantial changes to the autoswitcher that doesn’t do this on Mac, though it’s definitely imperfect. On that branch the autoswitcher occasionally crashes, or stops working if the pad is disconnected and reconnected: but easily fixed by restarting the autoswitcher. There also seems an issue that the first keypress is ignored when the pad wakes up from sleep. But on the whole, it does fix the issue!

@harryjubb
harryjubb / Postmortem
Created November 22, 2021 15:32 — forked from adhorn/Postmortem
Title:
Incident date:
Owner:
Peer-review committee:
Tags:
Summary:
Supporting data:
Customer Impact:
Incident Response Analysis:
Post-Incident Analysis:
/* From https://github.com/raspberrypi-ui/rc_gui/blob/master/src/rc_gui.c#L23-L70 */
#define GET_CAN_EXPAND "sudo raspi-config nonint get_can_expand"
#define EXPAND_FS "sudo raspi-config nonint do_expand_rootfs"
#define GET_HOSTNAME "sudo raspi-config nonint get_hostname"
#define SET_HOSTNAME "sudo raspi-config nonint do_hostname %s"
#define GET_BOOT_CLI "sudo raspi-config nonint get_boot_cli"
#define GET_AUTOLOGIN "sudo raspi-config nonint get_autologin"
#define SET_BOOT_CLI "sudo raspi-config nonint do_boot_behaviour B1"
#define SET_BOOT_CLIA "sudo raspi-config nonint do_boot_behaviour B2"
#define SET_BOOT_GUI "sudo raspi-config nonint do_boot_behaviour B3"

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@harryjubb
harryjubb / star.py
Created July 9, 2021 22:41
Raspberry Pi: Piezo Twinkle Twinkle Little Star
import RPi.GPIO as GPIO
from time import sleep
# Higher
notes = {
# 'A': 880,
'B': 988,
'C': 1047,
'D': 1175,
'E': 1318,
# Shutdown Docker for Windows and WSL
Stop-Process -Name "Docker Desktop"
Stop-Process -Name "Docker.Service"
wsl --shutdown
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
# 'filters': {
# 'require_debug_false': {
# '()': 'django.utils.log.RequireDebugFalse'
# }
# },
'handlers': {
# 'mail_admins': {
@harryjubb
harryjubb / mentioning_me.jql
Created March 20, 2019 11:05
JIRA Filters
(summary ~ currentUser() OR description ~ currentUser() OR comment ~ currentUser())

via (https://www.linux.com/learn/tutorials/442438-vim-tips-folding-fun)

  • zf#j creates a fold from the cursor down # lines.
  • zf/string creates a fold from the cursor to string .
  • zj moves the cursor to the next fold.
  • zk moves the cursor to the previous fold.
  • zo opens a fold at the cursor.
  • zO opens all folds at the cursor.
  • zm increases the foldlevel by one.
  • zM closes all open folds.