Skip to content

Instantly share code, notes, and snippets.

@pudquick
pudquick / colorsync.py
Last active December 20, 2015 16:18
ColorSync in python
# A new way
import objc
from CoreFoundation import CFURLRef, CFErrorRef
objc.parseBridgeSupport("""<?xml version='1.0'?>
<!DOCTYPE signatures SYSTEM "file://localhost/System/Library/DTDs/BridgeSupport.dtd">
<signatures version='1.0'>
<function name='ColorSyncProfileCreateWithURL'>
<arg type='^{__CFURL=}'/>
<arg type='^^{__CFError}' type_modifier='N'/>
<retval already_retained='true' type='^{ColorSyncProfile=}'/>
import re
import urllib2
from autopkglib import Processor, ProcessorError
__all__ = ["ExampleURLProvider"]
EXAMPLE_BASE_URL = "http://example.com/downloads"
@pudquick
pudquick / gist:7206203
Created October 28, 2013 22:50
EPSON WorkForce 610
The order they're filtered in:
EPSON_DriverCommon029
EPSON_DriverCommon048
EPSON_DriverCommon050
EPSON_DriverCommon052
EPSON_DriverCommon054
EPSON_DriverCommon083
EPSON_DriverCommon084
EPSON_DriverCommon087
EPSON_DriverCommon095
@pudquick
pudquick / mactech_2013_ical.py
Created November 7, 2013 09:43
This file automatically pulls the current calendar information for the 4 calendars published at schedule.mactech.com for MacTech 2013 and builds 4 separate .ics files with the information.
from icalendar import Event, Calendar
from datetime import datetime
import urllib2, urllib, pytz, dateutil.parser
import xml.etree.ElementTree as ET
ical_rss_base_url = 'http://schedule.mactech.com/rss/rss2.0.php?cal=%s&cpath=&rssview=month'
ical_rss_calendars = ['Dev Track', 'General Schedule', 'IT Track', 'Special']
# X-APPLE-CALENDAR-COLOR
@pudquick
pudquick / boo_curl.txt
Created November 16, 2013 21:37
Why use curl?
mbp:curl_is_bad mike$ python replace_curl.py http://www.google.com/
expected bytes: indeterminate
progress: http://www.google.com/ 0.0 (Total byte %: Unknown)
progress: http://www.google.com/ 10894.0 (Total byte %: Unknown)
received: 10894 bytes total
mbp:curl_is_bad mike$ python replace_curl.py http://i.imgur.com/qwNWR3c.jpg
expected bytes: 302444
progress: http://i.imgur.com/qwNWR3c.jpg 0.0 (Total byte %: 0.0)
progress: http://i.imgur.com/qwNWR3c.jpg 13967.0 (Total byte %: 4.6)
progress: http://i.imgur.com/qwNWR3c.jpg 18311.0 (Total byte %: 6.1)
# Before importing cert into keychain as trusted #
mbp:curl_is_bad mike$ python replace_curl.py https://tidia.ita.br/
Error: Valid cert chain, untrusted root
# After importing cert into keychain as trusted #
mbp:curl_is_bad mike$ python replace_curl.py https://tidia.ita.br/
expected bytes: 528
progress: https://tidia.ita.br/ 0.0 (Total byte %: 0.0)
@pudquick
pudquick / Info.plist
Last active February 19, 2021 16:41
Instructions on how to modify the Minecraft.app for OS X to work with Java 7 (without the need for 6). See the instructions in the "ReadMe" section.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key> <string>en</string>
<key>CFBundleName</key> <string>MinecraftLauncher</string>
<key>CFBundleVersion</key> <string>1.0.1</string>
<key>CFBundleShortVersionString</key> <string>MinecraftLauncher 1.0.1</string>
<key>CFBundleExecutable</key> <string>LaunchGame</string>
<key>CFBundlePackageType</key> <string>APPL</string>
@pudquick
pudquick / transtor.py
Created November 24, 2013 01:30
A Pythonista (python on iOS, check the App Store!) script for downloading torrents, modifying them, then uploading them to a Transmission server - directly from your iPhone / iPad
# Usage of this file:
# This code is intended for use in the iOS python interpreter named 'Pythonista'.
# When looking at a page on the torrentz.eu search engine for a torrent result from Mobile Safari
# you can click on a bookmarklet (mentioned below) and it will cause the following:
# - Search results for the page are scraped
# - Torrent sites are visited for direct download links for the .torrent file
# - A .torrent file is downloaded
# - The .torrent file trackers are updated to include the scraped trackers listed on torrentz.eu
# - The .torrent file is re-uploaded to your Dropbox account (for an on-demand HTTP source)
# - The direct download link for the modified .torrent file is passed via RPC to a Transmission torrent server
@pudquick
pudquick / misc.log
Last active December 29, 2015 08:09
gurl stuff
***Testing https://trustedsite.dev/ (Untrusted CA, unverifiable site)...***
Percent complete: 0
2013-11-24 12:22:08.057 Python[58711:1107] connection_canAuthenticateAgainstProtectionSpace_
2013-11-24 12:22:08.057 Python[58711:1107] Protection space found. Host: trustedsite.dev Realm: None AuthMethod: NSURLAuthenticationMethodServerTrust
2013-11-24 12:22:08.058 Python[58711:1107] Allowing OS to handle authentication request
Status: 200
Headers: {u'Content-Length': u'200', u'Content-Encoding': u'gzip', u'Accept-Ranges': u'bytes', u'Vary': u'Accept-Encoding', u'Keep-Alive': u'timeout=15, max=100', u'Server': u'Apache/2.2.14 (Ubuntu)', u'Last-Modified': u'Wed, 26 Aug 2009 18:37:54 GMT', u'Connection': u'Keep-Alive', u'Etag': u'"e000c-fd-4720fbfc0c480"', u'Date': u'Sun, 24 Nov 2013 20:25:15 GMT', u'Content-Type': u'text/html'}
mbp:gist7571880-64e49a6a3d6a693577ca6dd59e61c66271a7a443 mike$
***Testing https://trustedsite.dev/repo/catalogs/all (Client cert required)...***
@pudquick
pudquick / analysis.md
Last active December 29, 2015 10:19
Misc. munki client certificate analysis vs. Security framework / keychains

The reason that importing the CA cert that was created via the tutorial for setting up a HTTPS munki server failed was the certificates, not the import method.

Once I corrected the certificates, the following workflow worked:

# Create the keychain at ~/Library/Keychains/ (or specify a full path instead of a relative filename)

security create-keychain -p munki munki.keychain

# Unlock it