Skip to content

Instantly share code, notes, and snippets.

View ndbroadbent's full-sized avatar

Nathan Broadbent ndbroadbent

View GitHub Profile
@ndbroadbent
ndbroadbent / gist:7575592
Last active September 19, 2022 08:13
SCM Breeze git aliases
GFORCE => git add -A && git commit --amend -C HEAD && git push -f
c => git_index
cbg => git rev-parse --verify HEAD | simple_clipboard
g => git
ga => git_add_shortcuts
gaa => git add -A
gap => git add -p
gash => git stash
gasha => git stash apply
gashl => git stash list
@ndbroadbent
ndbroadbent / karabiner-elements-enter-fnfn.json
Last active September 8, 2022 23:19
Karabiner-Elements rule - Double press keypad_enter to press Fn twice and start dictation
{
"title": "Double tap keypad_enter to double tap fn (start dictation.) Single tap for keypad_enter after a short delay (250ms.)",
"rules": [
{
"description": "This rule solves a problem with the Microsoft Surface Ergonomic Keyboard. The `Fn` key can't be used to start dictation, since it only toggles an internal state on and off, and it does not actually send any keypress event. This rule allows you to start dictation by double tapping the keypad enter key, which will send Fn twice. If you only press the keypad enter key once, it will send the original enter key after a short delay (250ms).",
"manipulators": [
{
"conditions": [
{
"name": "keypad_enter pressed",
@ndbroadbent
ndbroadbent / rangehood.yaml
Created September 6, 2022 23:51
Rangehood ESP32 Controller - ESPHome Configuration
esphome:
name: rangehood
includes:
- rangehood_button_leds.h
esp32:
board: nodemcu-32s
framework:
type: arduino
@ndbroadbent
ndbroadbent / gist:3030358
Created July 2, 2012 01:16
Tiny Umbrella Crash
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/sun/jna/Platform
at com.semaphore.os.UIHandlerManager.getSystemUIHandler(UIHandlerManager.java:22)
at com.semaphore.TinyUmbrella.<clinit>(TinyUmbrella.java:131)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.semaphore.TinyLoader.loadTiny(TinyLoader.java:248)
at com.semaphore.TinyLoader.access$000(TinyLoader.java:29)
at com.semaphore.TinyLoader$1.run(TinyLoader.java:42)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
@ndbroadbent
ndbroadbent / run_failed_gitlab_pipeline_specs.sh
Created April 4, 2022 02:55
run_failed_gitlab_pipeline_specs
#!/bin/bash
set -eo pipefail
CURRENT_DIR="$(realpath $(dirname "$0"))"
ROOT_DIR="$(realpath $CURRENT_DIR/..)"
# https://gitlab.com/docspring/docspring
PROJECT_ID="1908805"
GITLAB_TOKEN=$(cat $ROOT_DIR/.gitlab-api-token)
@ndbroadbent
ndbroadbent / Gemfile
Last active December 11, 2021 22:31
How to get accurate SimpleCov coverage with Spring in a Rails application
group :development, :test do
gem 'spring-commands-rspec', require: false
gem 'spring-watcher-listen', require: false
gem 'spring', require: false
# ...
end
@ndbroadbent
ndbroadbent / getTotps - show image in console.js
Last active July 23, 2021 14:02 — forked from nmurthy/getTotps.js
export authy totp codes, show QR codes in the console
/* base32 */
/*
Copyright (c) 2011, Chris Umbel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@ndbroadbent
ndbroadbent / deploy.rake
Created September 28, 2012 22:18
Rake task for precompiling assets locally before deploying to Heroku
require 'fileutils'
# Warning: The following deploy task will completely overwrite whatever is currently deployed to Heroku.
# The deploy branch is rebased onto master, so the push needs to be forced.
desc "Deploy app to Heroku after precompiling assets"
task :deploy do
deploy_branch = 'heroku'
remote = 'heroku'
deploy_repo_dir = "tmp/heroku_deploy"
@ndbroadbent
ndbroadbent / gpt3-hangman.txt
Last active April 11, 2021 05:49
Some test GPT-3 training data for the hangman game
Hint: This person is an actor.
____ ____
=> e
There were no e's!
- Guesses: e
____ ____
=> t
There were 2 t's!
@ndbroadbent
ndbroadbent / create_combined_submission.deluge.js
Last active February 20, 2021 22:49
DocSpring + Zoho CRM - Examples for creating Submissions and Combined Submissions, and poll for status until they are processed
// Used for loop that waits for pending jobs to be processed.
LoopList={"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
"21", "22", "23", "24", "25", "26", "27", "28", "29", "30"};
templateID = "<TEMPLATE ID>";
apiTokenId = "<API TOKEN ID>";
apiTokenSecret = "<API TOKEN SECRET>";
base64EncodedLogin = zoho.encryption.base64Encode(apiTokenId + ":" + apiTokenSecret);