Skip to content

Instantly share code, notes, and snippets.

View WardsParadox's full-sized avatar

Zack McCauley WardsParadox

View GitHub Profile
@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'
@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 / 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 / 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 / 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 / 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 / encode.py
Last active December 19, 2016 19:48 — forked from signed0/gist:2031157
Google Polyline encoder & decoder
#!/usr/bin/python
'''Provides utility functions for encoding and decoding linestrings using the
Google encoded polyline algorithm.
Original Script at https://gist.github.com/signed0/2031157
'''
from sys import argv
from ast import literal_eval
def encode_coords(coords):
'''Encodes a polyline using Google's polyline algorithm
@WardsParadox
WardsParadox / Destiny Tables and Columns
Created September 8, 2017 19:39
Follet Destiny Tables and Columns
Table Name , Column
(u'Address', u'AddressID')
(u'Address', u'AddressType')
(u'Address', u'City')
(u'Address', u'Line1')
(u'Address', u'Line2')
(u'Address', u'OtherPhone')
(u'Address', u'PatronID')
(u'Address', u'PrimaryPhone')
(u'Address', u'State')
@WardsParadox
WardsParadox / passgen.py
Created April 30, 2018 19:36
PassGen for student passwords
#!/usr/bin/python
'''
Generates password of random 4-letter word + 4-digit number
'''
from random import randint, \
choice
import os
import argparse
import re
@WardsParadox
WardsParadox / chrome_pfm_manifest_merger.py
Last active July 13, 2018 21:42
Chrome PFM Merger - Requires Google Chrome in the Applications Folder
#!/usr/bin/python
# # -*- coding: utf-8 -*-
import plistlib
import os
from subprocess import call
#import base64
manifestpath = os.path.abspath('/Applications/Google Chrome.app/Contents/Resources/com.google.Chrome.manifest/Contents/Resources/com.google.Chrome.manifest')