Skip to content

Instantly share code, notes, and snippets.

mattvh /
Last active November 12, 2021 20:22
# Raspberry Pi Pushover IP Notifier
# by Matt Harzewski (2021)
# License: MIT
# On system boot, this script checks to see if
# the IP address has changed, and sends a
# Pushover notification if it is different.
# Set the user and application tokens with your
# own from, and add the script to
mattvh /
Last active December 21, 2020 00:49
Example for Medium article "Python Decorators Explained"
def decorate(func):
print("Do something before func()")
return func #return the original function, unmodified
def hello():
print("Hello, world!")
mattvh /
Created June 7, 2020 07:00
Writing a GUI Application with Python and Py2App
from setuptools import setup
APP = ['']
'argv_emulation': True,
'site_packages': True,
#'iconfile': 'appicon.icns',
'packages': ['wx', 'requests'],
'plist': {
mattvh / _layout.html
Created May 29, 2020 07:28
Baking Static Sites with Python and Jinja
View _layout.html
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>{{ title }}</title>
<link rel="stylesheet" href="static/style.css">
<div class="container">
mattvh / smstranscript.rb
Created July 7, 2017 02:52
Turns an iMessage conversation from an iPhone backup into an HTML transcript. MIT license.
View smstranscript.rb
# Converts an iPhone SMS.db file into HTML
# Mac: Library > Application Support > MobileSync > Backup
# Windows: C:\Users\<user name>\AppData\Roaming\Apple Computer\MobileSync\Backup
# Find the folder with the most recently modified date and open it.
# Locate the 3d0d7e5fb2ce288813306e4d4636395e047a3d28 file and copy it to the location of this script.
# Rename the file to "db.sqlite"
# Replace HANDLE_GOES_HERE with the phone number/etc identifying the other party in the DB.
# Run the script.
require "sqlite3"
mattvh / nudgemode.lua
Created July 27, 2015 06:19
Hammerspoon NudgeMode module
View nudgemode.lua
-- Window nudging and resizing with modal shortcuts
-- Initialize with desired mode keybind:
-- windowmode.init({"cmd", "alt", "ctrl", "shift"}, "m")
-- Nudge window with arrows, resize with shift and arrows
-- HJKL is also supported
-- Space or return exits nudge mode
-- ------------------------------------------------------
mattvh / imgur-tweetbot-api2.php
Created October 26, 2013 03:33
This is the original code from my tutorial on how to use the Imgur API with Tweetbot for Mac. Imgur has since iterated their API, which requires a new script. I'm just archiving the old one here, while I update the post for version 3.
View imgur-tweetbot-api2.php
class TweetbotImgurEndpoint {
private $api_key;
private $api_url = "";
private $file_temp_location;
private $file_name;
mattvh / favicon.rb
Last active September 4, 2020 12:13
Discovering and saving favicons with Ruby
View favicon.rb
# by Matt Harzewski
# Read more:
require "httparty"
require "nokogiri"
require "base64"
class Favicon