Skip to content

Instantly share code, notes, and snippets.

View clburlison's full-sized avatar

Clayton Burlison clburlison

View GitHub Profile
@clburlison
clburlison / set_desktop.py
Created February 4, 2016 14:03
Outset Desktop Set Example
#!/usr/bin/python
'''Uses Cocoa classes via PyObjC to set a desktop picture on all screens.
Tested on Mountain Lion and Mavericks. Inspired by Greg Neagle's work: https://gist.github.com/gregneagle/6957826
See:
https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSWorkspace_Class/Reference/Reference.html
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/Reference/Reference.html
@clburlison
clburlison / MainController.py
Last active February 12, 2016 01:55
Imagr include_workflows from URL 98.5% finished. For @erikng never completed or implemented at this point.
# -*- coding: utf-8 -*-
#
# MainController.py
# Imagr
#
# Created by Graham Gilbert on 04/04/2015.
# Copyright (c) 2015 Graham Gilbert. All rights reserved.
#
import objc
@clburlison
clburlison / simple_python_args_logging.py
Created February 15, 2016 18:54
Simple method for handling verbose logging with Python using argparse
#!/usr/bin/python
#http://stackoverflow.com/a/34065768/4811765
import argparse
import logging
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--verbose', action='count', default=0)
args = parser.parse_args()
levels = [logging.WARNING, logging.INFO, logging.DEBUG]
@clburlison
clburlison / MAContent10_GarageBandCoreContent-2.0.0.0.1.1256150330.plist
Created March 1, 2016 15:34
GarageBand CoreContents Full pkginfo Examples
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>_metadata</key>
<dict>
<key>created_by</key>
<string>techsupport</string>
<key>creation_date</key>
<date>2015-10-26T19:49:14Z</date>
@clburlison
clburlison / location.py
Last active June 27, 2016 19:42
This is all scratch work....please visit https://github.com/clburlison/pinpoint for finished result
#!/usr/bin/python
"""Enables location services (LS) globally,
Give Python access to location services,
Prints the current location to a plist.
Author: Clayton Burlison <https://clburlison.com>
Created: Jan. 25, 2016
Based off of works by:
@arubdesu - https://gist.github.com/arubdesu/b72585771a9f606ad800
@clburlison
clburlison / GPG and git on macOS.md
Created July 28, 2016 13:25 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@clburlison
clburlison / reverseGeo.py
Created September 16, 2016 21:23
Using CoreLocation GeoCoder in PyObjC
#!/usr/bin/python
from CoreLocation import CLLocation
from CoreLocation import CLGeocoder
from Foundation import NSLog, NSRunLoop, NSDate
location = CLLocation.alloc().initWithLatitude_longitude_(37.331762, -122.030561)
address = "1 Infinite Loop, Cupertino, CA 95014"
def myCompletionHandler(placemarks, error):
@clburlison
clburlison / args.py
Last active September 23, 2016 20:27 — forked from olooney/.gitignore
worked examples of argparse and python logging
#! /usr/bin/env python
"""Sample Code Demonstrating argparse and logging
Demonstrates appropriate logging techniques for a trivial command line program
that supports a variety of "verbosity" flags.
"""
import argparse
import logging
import logging.handlers
@clburlison
clburlison / pip_pkgs_update.sh
Last active October 11, 2016 21:17
Update pip packages
# from https://www.reddit.com/r/Python/comments/31viu3/why_pip_doesnt_have_a_command_to_upgrade_all/cq5efx9
pip list --outdated | cut -d ' ' -f1 | cut -d = -f1 | xargs -n1 pip install -U
#!/usr/bin/python
"""
Go use this instead: https://github.com/pbowden-msft/OfficeCDNCheck
A script to help determine which CDN you're client is talking to for
Microsoft Office 2016 updates.
Author: Clayton Burlison <https://clburlison.com>
Date Modifed: Sept. 14th, 2016