This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
"""Adobe API tools.""" | |
import sys | |
import time | |
import json | |
import os | |
try: | |
import jwt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
"""Adobe API tools.""" | |
import sys | |
import time | |
import json | |
import os | |
try: | |
import jwt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ported from https://github.com/timsutton/osx-vm-templates/blob/master/scripts/support/set_kcpassword.py | |
key = [125, 137, 82, 35, 210, 188, 221, 234, 163, 185, 31] | |
key_len = key.length | |
newpasswd = [] | |
passwd.each_char do |char| | |
newpasswd << char.ord | |
end | |
r = newpasswd.length % key_len |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
"""Bootstrap Chef with no other dependencies.""" | |
import os | |
import sys | |
import platform | |
import subprocess | |
import json | |
import plistlib | |
import urllib2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def app_paths(bundle_identifier) | |
# Search Spotlight for matching identifier, strip newlines | |
Mixlib::ShellOut.new( | |
"/usr/bin/mdfind \"kMDItemCFBundleIdentifier==#{bundle_identifier}\"" | |
).run_command.stdout.split('\n').map!(&:chomp) | |
end | |
def installed?(bundle_identifier) | |
paths = app_paths(bundle_identifier) | |
!paths.empty? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
paths_file = File.readlines('/etc/paths').map(&:strip) | |
[ | |
'/opt/path/to/A', | |
'/opt/path/to/B', | |
].each do|path| | |
paths_file.unshift(path) unless paths_file.include?(path) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import sqlite3 | |
tccpath = '/Library/Application Support/com.apple.TCC/TCC.db' | |
connection = sqlite3.connect(tccpath) | |
c = connection.cursor() | |
values = ('kTCCServiceAccessibility', 'com.rescuetime.RescueTime', 0) | |
c.execute('INSERT or REPLACE into access values(?, ?, ?, 1, 1, NULL, NULL)', values) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>Description</key> | |
<string>Downloads the latest Chef DK for Mac version.</string> | |
<key>Identifier</key> | |
<string>com.facebook.autopkg.download.chefdk</string> | |
<key>Input</key> | |
<dict> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Build finished successfully, image saved to /Library/AutoDMG/AutoDMG_full.hfs.dmg | |
Build successful | |
2015-12-28 09:35:29.059 AutoDMG[1429:313432] PyObjC: Converting exception to Objective-C: | |
sys.excepthook is missing | |
lost sys.stderr | |
2015-12-28 09:35:29.059 AutoDMG[1429:313440] PyObjC: Converting exception to Objective-C: | |
sys.excepthook is missing | |
lost sys.stderr | |
2015-12-28 09:35:29.059 AutoDMG[1429:313434] PyObjC: Converting exception to Objective-C: | |
sys.excepthook is missing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run(cmd): | |
'''Runs a command with subprocess, printing output in realtime''' | |
proc = subprocess.Popen( | |
cmd, | |
stdout=subprocess.PIPE, | |
stderr=subprocess.STDOUT | |
) | |
while proc.poll() is None: | |
l = proc.stdout.readline() | |
print l, |