Skip to content

Instantly share code, notes, and snippets.

View WardsParadox's full-sized avatar

Zack McCauley WardsParadox

View GitHub Profile
@WardsParadox
WardsParadox / boxcarNotify.py
Created November 15, 2016 21:31
boxcarNotify.py
#!/usr/bin/python
'''
Sends boxcar.io notifications, you need a token so sign up at boxcar.io!
'''
try:
import requests
except ImportError:
print 'Please install requests'
defaulticon = "https://github.com/munkireport/munkireport-php/raw/wip/assets/images/favicons/android-chrome-192x192.png"
def boxcarnotify(accesstoken, title, message, sound="success",
@WardsParadox
WardsParadox / getBundleID.py
Last active August 24, 2016 18:58
GetBundleID.py - Get's Bundle ID for passed App ID. ( https://kb.acronis.com/content/39368 )
#!/usr/bin/python
import json
import sys
from urllib2 import urlopen
AppID = sys.argv[1]
#AppID = "284910350" # Yelp app for testing
url = urlopen("https://itunes.apple.com/lookup?id={0}".format(AppID))
@WardsParadox
WardsParadox / getmodelinfo.py
Created June 27, 2016 17:27
Get Model Info
#!/usr/bin/python
'''
Gets the Model Info of your Mac from Apple's product site.
'''
from urllib2 import urlopen
from xml.dom import minidom
from sys import argv
def getmodeldesc(serial):
'''
@WardsParadox
WardsParadox / currentuserisadmin.sh
Created April 21, 2016 19:56
Get Current User and if they are admin
#!/bin/bash
# Grabs the current logged in user and detects if they are admin
# Per MacMule's better dection of the logged in user:
loggedInUser=`python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");'`
# Per munkireport-php's localadmin module
admin_users=''
for user in $(dscl . -list /Users | grep -v "^_\|^root$") ; do
@WardsParadox
WardsParadox / getpreference.py
Last active March 7, 2016 22:55
Get OS X Preference with Python
#!/usr/bin/python
from Foundation import CFPreferencesCopyValue, \
kCFPreferencesAnyUser, \
kCFPreferencesAnyHost
def getpreferencekey(keytolookup):
'''
Returns Value for Requested Key in ManagedInstalls
'''
return CFPreferencesCopyValue(keytolookup, "/Library/Preferences/ManagedInstalls",
kCFPreferencesAnyUser, kCFPreferencesAnyHost)
@WardsParadox
WardsParadox / gist:a3935a44a3b749761a1e
Created September 29, 2015 02:57
SMTP Mailer in python for Cacher. I couldn't get the Mail to send via the OS X Server interface. Found mass majority on StackOverflow
#!/usr/bin/env python
# Settings
SMTP_SERVER = 'smtp.gmail.com'
SMTP_PORT = 465
SMTP_USERNAME = 'EMAILHERE'
SMTP_PASSWORD = 'PASSHERE'
SMTP_FROM = 'SAMEASUSERNAME'
SMTP_TO = 'TOEMAIL'