Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
import sys, datetime, time, subprocess
def apple_year_offset(dateobj, years=0):
# Convert to a maleable format
mod_time = dateobj.timetuple()
# Offset year by number of years
mod_time = time.struct_time(tuple([mod_time[0]+years]) + mod_time[1:])
# Convert back to a datetime obj
return datetime.datetime.fromtimestamp(int(time.mktime(mod_time)))
@korylprince
korylprince / merge.py
Last active October 31, 2023 02:01
Modify 10.13 (SFL2) Server Favorites list
#!/usr/local/munki/munki-python
# change the above path to your own python if you don't have Munki installed
"""
Merges add_servers into current favorites and removes remove_servers.
Run as root to update all users or as normal user to update just that user.
"""
import os
import getpass
@ttscoff
ttscoff / appinfo.md
Last active March 4, 2024 12:00
appinfo: A quick ruby script for Mac that returns some information for a specified Mac app in Terminal. Includes icon display if using imgcat or chafa are available.

appinfo

A script for getting details of installed Mac apps. Like Get Info but faster and cooler.

Save the script below as appinfo somewhere in your path. Make it executable with chmod a+x appinfo. Then just run appinfo APPNAME to get info on any installed app.

@joshua-d-miller
joshua-d-miller / 802.1x System Fix.py
Last active February 4, 2022 14:42
This script will allow your 802.1x Configuration Profile to work on any other Ethernet interface at the System Level
#!/usr/bin/python
# pylint: disable=E0611, E1101, E0602
''''Fix 802.1x When Using Config Profiles and PEAP-MSCHAPV2 or EAP-TLS'''
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# This script will find the system profile that is attached to one ethernet
# interface from our configuration profile and then copy it to all other
# ethernet interfaces so that other ethernet interfaces can be used instead
# of just the FirstActiveEthernet at time of profile installation. This issue
# is still an issue as of 10.12.3
@trodemaster
trodemaster / PowerCli.txt
Last active October 20, 2016 02:02
Some install notes for macOS + .net core + powershell core + PowerCli core
#Install openssl via macports
sudo port install openssl curl
# create a dir in the path for library links
mkdir -p /usr/local/lib
# link tehse librarys ino the path. Not sure this is needed..
ln -s /opt/local/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /opt/local/lib/libssl.1.0.0.dylib /usr/local/lib/
@opragel
opragel / ea_microsoft_outlook2016_versioncheck.py
Last active November 8, 2016 03:16
ea_microsoft_outlook2016_versioncheck.py
#!/usr/bin/python
"""
This script checks whether the installed version of Microsoft Outlook 2016 is
equal, less, or more than the target version defined by APP_TARGET_VERSION
and reports the result in Casper Suite extension attribute style.
T = Local app version is equal to provided target version
N = Local app version is newer than provided target version
F = Local app version is less than provided target version
N/A = Local app plist was not found or accesible at specified path
"""
@rderewianko
rderewianko / CheckWarranty
Last active September 28, 2015 19:45
Checks warranty of a machine, and reports back to the user in a popup
#!/bin/sh
#File Name:CheckWarranty.sh
########################################################################
# Created By: Andrew Tomson Modified by Ross Derewianko for Self Service
# Creation Date: Sept 2015
# Last modified: Sept 28, 2015
# Brief Description: Lets the user Know its changed
########################################################################
# this script was written to query apple's service database to determine warranty coverage
# base on a system's serial number. This updated version stores the infomration locally so
@pmbuko
pmbuko / quick_ad_pass_exp.sh
Created July 10, 2015 20:43
This script will return info on Active Directory password expiration for the currently active user when run on a Mac bound to an AD domain.
#!/bin/bash
# This section uses python to get the current console user. You can
# usually just use the built-in $USER variable, but this is more
# robust.
USER=$(/usr/bin/python -c \
'from SystemConfiguration import SCDynamicStoreCopyConsoleUser;\
print SCDynamicStoreCopyConsoleUser(None, None, None)[0]')
# This looks up the password expiration date from AD. It's stored
@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))