Skip to content

Instantly share code, notes, and snippets.

@krispayne
krispayne / bring_the_payne.py
Last active May 4, 2017 21:13 — forked from sheagcraig/bring_the_payne.py
Get IP Address for all computers in the JSS
#!/usr/bin/env python
"""https://twitter.com/krispayne/status/859833552078225408:
@shea_craig is possible with python-jss to generate a list of IP addresses for
computers in the JSS?
"""
from operator import itemgetter
# This example uses python-jss 2.0.0+
#!/bin/bash
# Mount a network time machine sparsebunble who's claimed to have gotten corrupt and no longer backs up.
# I do this from a different mac than the one doing the backups.
if [[ $(whoami) != 'root' ]]; then
echo "Must be run as root, dude."
exit 1
fi
read -p 'Enter path of TimeMachine Server (i.e. 123.45.6.7/TimeMachine): ' TM_PATH
#!/bin/bash
# check for a printer driver
# utilizes Casper parameters
PRINTER_DRIVER="${4}"
TRIGGER="${5}"
BASEPPD="/Library/Printers/PPDs/Contents/Resources"
if [[ ! -e "${BASEPPD}/${PRINTER_DRIVER}" ]]; then
echo "Installing driver from Casper..."
#!/bin/bash
# Extension attribute to find if bad network is on device
# Modified from:
# Lauren Caliolio 8/22/2014
# Contact me: laurendc@gmail.com, twitter @laurendc or JAMFNation: laurendc
# Wireless network to hunt
HUNT="old-public-ssid"
# Find device on hardware irregardless of model
#!/bin/bash
# Unlock that account, you sly computer
# Path to CocoaDialog
CD="/Applications/Utilities/cocoaDialog.app/Contents/MacOS/cocoaDialog"
# Quick sanity check to make sure cocoaDialog is installed in the path specified
if [ ! -e "$CD" ]; then
echo "cocoaDialog was not found in the path specified. It may not be installed, or the path is wrong. Exiting..."
exit 1
#!/bin/bash
# Displays a dialog for the user prompting them to restart after a software update
# Variables
# CocoaDialog location
CD="/Applications/Utilities/cocoaDialog.app/Contents/MacOS/CocoaDialog"
# Get the logged in user
loggedInUser=$(ls -l /dev/console|cut -d' ' -f4)
@krispayne
krispayne / ToggleWiFi.md
Last active July 25, 2016 17:19 — forked from markaltmann/Toggle WiFi
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac.

Overview

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland and Albert Bori

Requirements

  • Mac OSX 10+
  • Administrator privileges
#!/bin/bash
# gmail message recall
# requires Got Your Back https://github.com/jay0lee/got-your-back and a service account.
CSV="user-list.csv"
MSGID="" # Enter the full message ID here from the "Show Original" in Gmail. Leave out the '<>'
GYB="" # location of Got Your Back pythyon script /Users/username/gyb/gyb.py
DOMAIN="" # google apps domain e.g. google.com
OLDIFS=$IFS
#!/bin/bash
# Allow anyone to install a printer
# https://jamfnation.jamfsoftware.com/discussion.html?id=14640
echo Adding users to lpadmin
dseditgroup -o edit -n /Local/Default -a everyone -t group lpadmin
defaults write /System/Library/LaunchAgents/com.apple.printuitool.agent.plist Disabled -bool YES
defaults write /System/Library/LaunchAgents/com.apple.printuitool.agent.plist EnableTransactions -bool NO
security authorizationdb write system.preferences allow
security authorizationdb write system.print.operator allow
@krispayne
krispayne / jss-delete-computer.sh
Last active February 10, 2016 16:51
Delete Computers from a JSS based off a CSV of Serial numbers.
#!/bin/bash
# Deletes a machine from the JSS based off serial number from CSV
CSV="serials_to_remove.csv"
URL="https://your.jss.com:8443"
OLDIFS=$IFS
IFS=,
[ ! -f $CSV ] && { echo "$CSV file not found"; exit 99; }
while read serial