Skip to content

Instantly share code, notes, and snippets.

View nmcspadden's full-sized avatar

Nick McSpadden nmcspadden

View GitHub Profile
@OrangeDrangon
OrangeDrangon / README.md
Last active March 31, 2024 20:08
BitBurner Contract Solvers

All of the scripts for contracts in Bitburner.

@pudquick
pudquick / keychain_password.py
Created March 6, 2017 20:53
Storing and retrieving a generic password in the login.keychain in macOS via python and pyobjc
import objc
from ctypes import c_char
from Foundation import NSBundle
Security = NSBundle.bundleWithIdentifier_('com.apple.security')
S_functions = [
('SecKeychainGetTypeID', 'I'),
('SecKeychainItemGetTypeID', 'I'),
('SecKeychainAddGenericPassword', 'i^{OpaqueSecKeychainRef=}I*I*I*o^^{OpaqueSecKeychainItemRef}'),
('SecKeychainOpen', 'i*o^^{OpaqueSecKeychainRef}'),
@pudquick
pudquick / xcode_get.py
Last active December 7, 2020 09:01
Stupid tricks: using stock macOS python subprocess with curl to download products from Apple's Developer Center
from subprocess import Popen, PIPE, STDOUT, check_output
from mimetools import Message
from StringIO import StringIO
from urlparse import urlparse, parse_qs
from urllib import quote, basejoin, urlencode
DEV_SITE = 'https://developer.apple.com'
AUTH_SITE = 'https://idmsa.apple.com'
AUTH_PATH = '/IDMSWebAuth/authenticate'
APPIDKEY_PATH = "/services-account/download?path=%s"
@bruienne
bruienne / google_chrome_update_checker.py
Created September 27, 2016 19:24
Basic concept for querying for Google Chrome updates based on current Chrome version/OS/arch
#!/usr/bin/python
import xml.etree.ElementTree as ET
import requests
import uuid
params = {'cup2hreq': 'foo', 'cup2key': 'bar'}
platform = 'mac'
os_version = '10.12'
@jessepeterson
jessepeterson / getgrouplist_2.py
Last active May 30, 2018 16:30
getgrouplist using OS X-specific API
#!/usr/bin/python
import grp, pwd, os
from ctypes import *
from ctypes.util import find_library
libc = cdll.LoadLibrary(find_library('libc'))
# getgrouplist_2() is an undocumented API which, I beleive, retrives all of
# a user's groups instead of the maximum 16 groups which getgrouplist() gets
@timsutton
timsutton / auto-update-mas-apps.sh
Last active March 7, 2018 06:54
Clear storeagent cache and trigger Mac App Store app updates.
#!/bin/sh
#
# Trigger an update of MAS (and softwareupdate) apps
#
# This seems to be all that's needed to schedule an immediate update of
# MAS apps. This should be run as a normal user. You can run this and
# tail the install log to get an idea of what's happening.
#
# You can also take a look at this user's ~/Library/Caches/com.apple.storagent
# directory to get a report on what apps were available, installable, etc.
@pudquick
pudquick / mas_updates.py
Last active January 25, 2024 15:47
Mac App Store updates
# App Store playing
import urllib, urllib2, json, plistlib
###
# Utility function for performing an iTunes-style search
def perform_itunes_search(api_url, query_list=[]):
query_str = urllib.urlencode(query_list)
response_handle = urllib2.urlopen('https://itunes.apple.com/%s?%s' % (api_url, query_str))
@gregneagle
gregneagle / NSPredicateTester.py
Last active June 14, 2023 21:47
NSPredicateTester.py
#!/usr/local/munki/munki-python
import sys
import os
from Foundation import NSDate
from Foundation import NSPredicate
def doComparison(comp_string, obj):
print('Comparison: %s' % comp_string)