Skip to content

Instantly share code, notes, and snippets.

View n8henrie's full-sized avatar

Nathan Henrie n8henrie

View GitHub Profile
@n8henrie
n8henrie / detect_displays.applescript
Created January 22, 2016 19:12
UI Script to click the "detect displays" button in System Preferences on OS X 10.11 El Capitan
-- Minimally modified from:
-- http://www.insanelymac.com/forum/topic/59163-detect-displays-by-command-or-script/?p=457644
activate application "System Preferences"
tell application "System Events"
tell application process "System Preferences"
tell window 1
click button "Show All" of group 1 of group 2 of toolbar 1 (* in case another pane is already open *)
tell button "Displays" of scroll area 1
repeat until exists (* wait until the object is accessible *)
delay 0.2
@n8henrie
n8henrie / argparse_logger.py
Last active June 20, 2021 21:18
Example script showing a way to increase logging verbosity with argparse and the logging module.
#! /usr/bin/env python3
"""argparse_logger.py
Example script showing a way to increase logging verbosity with argparse and
the logging module.
https://docs.python.org/2/library/logging.html#logging-levels
Usage:
- `python3 argparse_logger.py`
@n8henrie
n8henrie / pyscript.py
Last active January 3, 2022 20:03 — forked from nhoffman/pyscript.py
Python script template
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""pyscript.py
A simple python script template.
http://ajminich.com/2013/08/01/10-things-i-wish-every-python-script-did/
"""
import argparse
@n8henrie
n8henrie / homebridge-dummy-config.json
Created December 27, 2015 20:29
Dummy config file for testing homebridge setup
{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"
},
"description": "Example config file to test with a homebridge-dummy switch.",
@n8henrie
n8henrie / jessie_2015-11-21.txt
Created December 14, 2015 23:06
http://n8henrie.com/2015/12/default-packages-on-raspbian-jessie-jessie-lite-and-wheezy Default packages on fresh image of Raspbian Jessie 2015-11-21 SHA-1 ce1654f4b0492b3bcc93b233f431539b3df2f813
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=====================================-=========================================-============-===============================================================================
ii acl 2.2.52-2 armhf Access control list utilities
ii adduser 3.113+nmu3 all add and remove users and groups
ii adwaita-icon-theme 3.14.0-2 all default icon theme of GNOME
ii alacarte 3.11.91-2+rpi1 all easy GNOME menu editing tool
ii alsa-base 1.0.27+1
@n8henrie
n8henrie / jessie_lite_2015-11-21.txt
Created December 14, 2015 23:06
http://n8henrie.com/2015/12/default-packages-on-raspbian-jessie-jessie-lite-and-wheezy Default packages on fresh image of Raspbian Jessie Lite 2015-11-21 SHA-1 97888fcd9bfbbae2a359b0f1d199850852bf0104
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============================-==========================-============-===============================================================================
ii acl 2.2.52-2 armhf Access control list utilities
ii adduser 3.113+nmu3 all add and remove users and groups
ii alsa-utils 1.0.28-1 armhf Utilities for configuring and using ALSA
ii apt 1.0.9.8.1 armhf commandline package manager
ii apt-utils 1.0.9.8.1 armhf package management related utility programs
@n8henrie
n8henrie / wheezy_2015-05-05.txt
Created December 14, 2015 23:06
http://n8henrie.com/2015/12/default-packages-on-raspbian-jessie-jessie-lite-and-wheezy Default packages on fresh image of Raspbian Wheezy 2015-05-05 SHA-1 cb799af077930ff7cbcfaa251b4c6e25b11483de
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=====================================-=======================================-============-============================================================================
ii adduser 3.113+nmu3 all add and remove users and groups
ii alsa-base 1.0.25+3~deb7u1 all ALSA driver configuration files
ii alsa-utils 1.0.25-4 armhf Utilities for configuring and using ALSA
ii apt 0.9.7.9+rpi1+deb7u7 armhf commandline package manager
ii apt-utils 0.9.7.9+rp
@n8henrie
n8henrie / get_nodejs.sh
Last active October 3, 2017 21:25
Quick bash script to download, extract, and set permissions on the latest nodejs 4.x for use on my Raspberry Pi B+.
#! /bin/bash
# get_nodejs.sh
# Quick script to help me download and install latest nodejs 4.x on my
# Raspberry Pi B+. May require sudo / root permissions depending on what
# destination directories (`node_dest`) you use. Don't forget to `chmod +x` the
# script.
set -euf -o pipefail
@n8henrie
n8henrie / mint_date_range.js
Last active January 29, 2022 04:11
Bookmarklet to filter Mint transactions by date range
// mint_date_range.js
// https://mint.lc.intuit.com/questions/948537-mint-faq-how-can-i-view-transactions-within-a-specific-date-range
// jsmin <mint_date_range.js
//
// Copy the minified version below into a bookmarklet
// javascript:(function(){var currentUrl=window.location.href;var destUrl="https://wwws.mint.com/transaction.event?";var today=new Date();var today_str=today.getMonth()+1+"/"+today.getDate()+"/"+today.getFullYear();var startDate=prompt("Start Date? Format: MM/DD/YYYY","");var endDate=prompt("End Date? Format: MM/DD/YYYY",today_str);destUrl+="&startDate="+startDate+"&endDate="+endDate;if(currentUrl.indexOf("wwws.mint.com")>-1){location.href=destUrl;}else{window.open(destUrl);}})();
var currentUrl = window.location.href;
var destUrl = "https://wwws.mint.com/transaction.event?";
@n8henrie
n8henrie / chrome_se_export.py
Created November 4, 2015 22:50
Export your Chrome search engines to JSON.
"""chrome_se_export.py
Export your Chrome search engines to JSON.
"""
import os.path
import sqlite3
import re
import json
import click