Skip to content

Instantly share code, notes, and snippets.

Dr. Drang drdrang

Block or report user

Report or block drdrang

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
drdrang /
Created Dec 10, 2017
Clean up Southwest Airlines ICS files.
from icalendar import Calendar
import sys
import copy
from datetime import timedelta
for ics in sys.argv[1:]:
# Open the ics file and extract the event and alarm.
cal = Calendar.from_ical(open(ics).read())
drdrang /
Last active Mar 18, 2018
Extract feeds from Safari and print them as OPML.
from plistlib import readPlist
from os import environ
from cgi import escape
# OPML template with header and footer.
opml = '''<?xml version="1.0"?>
<opml version="1.1">
drdrang / Purge Old Reminders.scpt
Last active Apr 23, 2020
AppleScript to delete all reminders more than 30 days old.
View Purge Old Reminders.scpt
set remindersOpen to application "Reminders" is running
set monthAgo to (current date) - (30 * days)
tell application "Reminders"
set myLists to name of every list
repeat with thisList in myLists
tell list thisList
delete (every reminder whose completion date is less than monthAgo)
end tell
end repeat
drdrang / desktop
Created Apr 28, 2016
Toggle the visibility of icons on the OS X Desktop. A reworking of Craig Hockenberry's original:
View desktop
# Toggle the visibility of Desktop icons.
# Desktop icons are visible if the CreateDesktop setting is missing or
# if it exists and is set to 1, true, yes, or on (case insensitive).
# Desktop icons are hidden if the CreateDesktop setting exists and
# is set to any value other than 1, true, yes, or on.
# The $icons variable is the value of CreateDesktop if it exists or is
drdrang / dayfeed-alt
Created Dec 23, 2015
Adjusted version of dayfeed to handle entries with no body.
View dayfeed-alt
#!/usr/bin/env python
# coding=utf8
import feedparser as fp
import time
from datetime import datetime, timedelta
import pytz
subscriptions = [
drdrang / testfeeds
Created Dec 23, 2015
Check the entries of a list of feeds for content/value and summary items.
View testfeeds
#!/usr/bin/env python
# coding=utf8
import feedparser as fp
import time
from datetime import datetime, timedelta
import pytz
subscriptions = [
View nextWorkWeek.js
var oneday = 60*60*24*1000;
var today = new Date();
var wToday = today.getDay();
var away = 1 - wToday;
if (away <= 0) { away += 7; }
var nextMonday = new Date(today.getTime() + away*oneday )
var theFriday = new Date(nextMonday.getTime() + 4*oneday)
nextMonday.toDateString() + ' to ' + theFriday.toDateString();
drdrang / Amazon referral link
Created Oct 17, 2014
A TextExpander AppleScript snippet for inserting an affiliate link to the current Amazon page.
View Amazon referral link
drdrang /
Created Oct 14, 2014
Pythonista script for putting two screenshots side by side.
import Image
import photos, speech, console
speech.say('left image?', '', .18)
s1 = photos.pick_image()
speech.say('right image?', '', .18)
s2 = photos.pick_image()
w = s1.size[0] + s2.size[0] + 60
h = max(s1.size[1], s2.size[1]) + 40
drdrang / clockface
Last active Aug 4, 2016
Prints Emoji clockface of the given time rounded to the nearest half-hour. Uses current time if none given. After
View clockface
# -*- coding: utf-8 -*-
from sys import argv
from time import strftime
clocks = {'12:00': '🕛', '12:30': '🕧', '1:00': '🕐', '1:30': '🕜',
'2:00': '🕑', '2:30': '🕝', '3:00': '🕒', '3:30': '🕞',
'4:00': '🕓', '4:30': '🕟', '5:00': '🕔', '5:30': '🕠',
'6:00': '🕕', '6:30': '🕡', '7:00': '🕖', '7:30': '🕢',
You can’t perform that action at this time.