Skip to content

Instantly share code, notes, and snippets.

View robmathers's full-sized avatar

Rob Mathers robmathers

View GitHub Profile
@robmathers
robmathers / itunesart.py
Last active December 19, 2015 04:18
Grabs full size iTunes artwork for search parameters on the command line
#!/usr/bin/env python
import httplib
import json
import re
import sys
from urllib import quote_plus
def iTunesData(keywords, media = 'all'):
iTunesDomain = 'itunes.apple.com'
if media not in ['movie', 'podcast', 'music', 'musicVideo', 'audiobook', 'shortFilm', 'tvShow', 'software', 'ebook', 'all']:
@robmathers
robmathers / readinglisturls.py
Last active November 16, 2023 21:18
Prints out URLs of items in Safari’s Reading List
#!/usr/bin/env python
import plistlib
from shutil import copy
import subprocess
import os
from tempfile import gettempdir
import sys
import atexit
BOOKMARKS_PLIST = '~/Library/Safari/Bookmarks.plist'
@robmathers
robmathers / mkvconverter.py
Created July 16, 2013 03:05
Converts mkvs with h.264 video into m4v containers. Needs mp4box, mediainfo, ffmpeg and probably some other command line tools installed (most of which should be installable via homebrew).
#!/usr/bin/env python
import sys
import os
import subprocess
from pymediainfo import MediaInfo
from glob import glob
import shlex
from fractions import Fraction
import ssatosrt
@robmathers
robmathers / handbrakechapters.py
Created September 6, 2013 21:16
Converts a OGG format chapters to csv format for use with Handbrake. Uses stdin/stdout for easy use with other command-line utilities.
#!/usr/bin/env python
from sys import stdin, stdout
import re
pattern = re.compile("CHAPTER0*(\\d+)=[\\d:\\.]+\\nCHAPTER0*\\1NAME=(.*)$", flags = re.MULTILINE)
replacement = "\\1,\\2"
input = stdin.read()
output = pattern.sub(replacement, input)
@robmathers
robmathers / feed.xml
Last active August 29, 2015 13:58
Gist for verynicewebsite.net feed that hasn't updated in Feedbin since March 27 (as of April 6, 2014). Bug report for Feedbin.
<?xml version="1.0" encoding="UTF-8"?><feed
xmlns="http://www.w3.org/2005/Atom"
xmlns:thr="http://purl.org/syndication/thread/1.0"
xml:lang=""
xml:base="http://verynicewebsite.net/wp-atom.php"
>
<title type="text">John Moltz&#039;s Very Nice Web Site</title>
<subtitle type="text"></subtitle>
<updated>2014-04-05T17:01:27Z</updated>
@robmathers
robmathers / gist:676c26bf605d5b2fbb71
Created July 22, 2014 02:08
accidentalbot: Links Can Get Mixed in With Titles sample html
<html><head>
<title>Showbot — Liss is More</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0">
<link rel="stylesheet" type="text/css" href="/css/site.css">
<link rel="alternate" type="application/rss+xml" title="Liss is More" href="http://www.caseyliss.com/rss">
<link rel="icon" type="image/png" href="http://www.caseyliss.com/images/favicon.png">
<link rel="apple-touch-icon" href="http://www.caseyliss.com/images/favicon.png">
<script async="" src="//www.google-analytics.com/analytics.js"></script><script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@robmathers
robmathers / linkstats.md
Last active August 29, 2015 14:07
Further statistics on John Siracusa's OS X Yosemite Review

Some further stats on the links (excluding links to sections of the article, and promotional links, i.e. eBooks/Ars subscriptions) in John Siracusa's OS X Yosemite review.

There are 406 total links, of which 362 are unique.

Top three link destinations (71% of total links):

  1. Ars Technica: 146
  2. Wikipedia: 96
  3. Apple: 45
  • developer.apple.com: 32
@robmathers
robmathers / Re-Fireballer
Last active August 29, 2015 14:22
Sample output from a script to test old Daring Fireball links
-----
Daring Fireball: Pepper Author Maarten Hekkelman
http://daringfireball.net/2002/08/pepper_author_maarten_hekkelman
-----
12 links found
3 links OK
3 redirects OK:
"http://www.hekkelman.com/": http://www.hekkelman.com/ -> "Hekkelman Programmatuur" http://www.hekkelman.net
@robmathers
robmathers / port_forwarding.sh
Last active August 28, 2018 15:35
Improved version of the Private Internet Access port forwarding script with better cross-platform support
#!/usr/bin/env bash
#
# Enable port forwarding when using Private Internet Access
#
# Usage:
# ./port_forwarding.sh
error( )
{
echo "$@" 1>&2
@robmathers
robmathers / ImageColourMask.swift
Last active July 13, 2018 22:03 — forked from omz/gist:1102091
Swift UIImage extension to create arbitrarily-colored icons from a black-with-alpha master image
//
// ImageColourMask.swift
//
// Created by Rob Mathers on 2018-07-13.
// Swift version of https://gist.github.com/omz/1102091/e03982f00ecc34be6c40aedcb0932ed374992741
// Original Objective-C version by Marco Arment and Ole Zorn
//
// Usage example:
// let maskedImage = UIImage(named: "test")?.maskedImage(color: UIColor.blue)