View http-status-codes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"100" : { | |
"title": "Continue", | |
"description": "Client should continue with request." | |
}, | |
"101" : { | |
"title": "Switching Protocols", | |
"description": "Server is switching protocols." | |
}, | |
"102" : { |
View client-side-alert.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body onload="showOrHideAlert()"> | |
<div id='alert' style="background:yellow"> | |
Alert banner generated by PHP, always in the HTML | |
<a id='alert_dismiss' onclick="setDismissAlertCookie()">[X]</a> | |
</div> | |
<script> | |
function showOrHideAlert() { | |
const hidden = document.cookie.split('; ').find(row => row.startsWith('dismissAlert='))?.split('=')[1]; |
View dsca-convert-db-to-localhost.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#$1 is the first parameter being passed when calling the script. The variable filename will be used to refer to this. | |
FILENAME=$1 | |
DSCA_LOCALHOST_ADDR="" | |
echo "🏃 doing r+r" | |
# s+r https to http (until I get a RP setup locally) |
View dollarsign-minimal.zsh-theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install: | |
# | |
# 1. create a file with this gists contents | |
# $ vi ~/.oh-my-zsh/themes/dollarsign-minimal.zsh-theme | |
# | |
# 2. edit ~/.zshrc and set `ZSH_THEME="dollarsign-minimal"` | |
# $ vi ~/.zshrc | |
# | |
# 3. reload zshrc | |
# $ source ~/.zshrc |
View convert-alfred-snippets-to-espanso.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Convert Alfred Snippets to Espanso matches | |
* | |
* @see https://www.alfredapp.com/help/features/snippets/ | |
* @see https://espanso.org/ | |
*/ | |
define('SNIPPETS_DIR', '/path/to/export/of/Alfred/snippets/'); |
View rpi-oled-sys+pihole-stats.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# System and PiHole stats for 128x32 OLED screen | |
# | |
# Add to: `/etc/rc.local` for boot start. | |
# | |
# @author learn.adafruit.com, davidsword | |
# @link https://gist.github.com/davidsword/0e9556ac19b5ef02d93d73931fec659e | |
# @version 20210131 | |
import time | |
import subprocess |
View ESP8266 NodeMCU RGB LED Busy Server.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ESP8266 NodeMCU RGB LED Busy Server | |
* | |
* Set an RGB LED to current status via web request | |
* | |
* 1. Flash this file to a ESP-12E | |
* 2. Open Serial to get the IP address of board | |
* 3. Optionally set a dedicated DHCP reservation at the router level to ensure same IP address is used | |
* 4. Connect common anode or common cathode RGB LED (see pins below) | |
* 5. Make `GET` request to `http://<IP>/<status>` | |
* |
View oled-count-game.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://davidsword.ca/learning-to-count-to-5-with-a-raspberry-pi/ | |
import time | |
import busio | |
import adafruit_ssd1306 | |
import RPi.GPIO as GPIO | |
from board import SCL, SDA | |
from PIL import Image, ImageDraw, ImageFont | |
# settings |
View rgb-led-status.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://davidsword.ca/a-cheaper-diy-status-light/ | |
import sys | |
import RPi.GPIO as GPIO | |
GPIO.setwarnings(False) | |
# Note this is BOARD numbering. | |
GPIO.setmode(GPIO.BOARD) | |
redPin = 3 |
View get-assoc-pr.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GH_TOKEN="" | |
GH_REPO="" | |
GH_OWNER="" | |
GH_SHA="" | |
# Get the PULL number that's realted to the commit on this build | |
PULL=$(curl -H "Authorization: bearer ${GH_TOKEN}" -s -d "{ \ | |
\"query\": \"query { \ | |
repository(owner: \\\"$GH_OWNER\\\", name: \\\"$GH_REPO\\\") { \ | |
commit: object(expression: \\\"$GH_SHA\\\") { \ |
NewerOlder