Skip to content

Instantly share code, notes, and snippets.

View rustymyers's full-sized avatar
🤓
Working from home

Rusty Myers rustymyers

🤓
Working from home
View GitHub Profile
# Check for active connection
while [ "$NETACTIVE" == 'FALSE' ]; do
# If block to test internet availability
if ping -nc 3 8.8.8.8 | grep '100.0%' >/dev/null 2>&1;then
/bin/echo $(date) "failed to connect to server"
exit 1
else
/bin/echo $(date) "Success connecting to server"
# Do stuff here
NETACTIVE=TRUE
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>com.foo.displaymirroring</string>
<key>LimitLoadToSessionType</key>
<array>
#!/usr/local/bin/python
import os
# import subprocess
# import re
ProfileInstalled = False
getprofile='/usr/bin/profiles -C'
print("GetProfile: "+getprofile)
profileDump = os.popen("/usr/bin/profiles -C")
@rustymyers
rustymyers / gist:4b8b7eeb35c650266377
Created August 25, 2014 17:41
screensaver idle time profile
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1">
<dict>
<key>PayloadUUID</key>
<string>35956225-3AA0-4735-BA3B-68224F26381E</string>
<key>PayloadType</key>
<string>Configuration</string>
<key>PayloadOrganization</key>
<string></string>
@rustymyers
rustymyers / gist:72863aa8537f5a660c22
Created June 8, 2015 14:52
IdleLogout.app LaunchAgent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>edu.psu.clc.idlelogout</string>
<key>ProgramArguments</key>
<array>
<string>open</string>
<string>/Library/CLMshared/Startup Items/Idle Logout.app</string>
$ cat preferences.js
pref("app.update.url", "http://url.com/update.xml");
pref("app.update.url.manual", "http://url.com/manual");
$ perl -i~ -pe 's{pref("app.update.url", "http://url.com/update.xml");}{pref("app.update.url", "http://custom.edu/update.xml");}g' preferences.js
$ cat preferences.js*
pref("app.update.url", "http://url.com/update.xml");
pref("app.update.url.manual", "http://url.com/manual");
pref("app.update.url", "http://url.com/update.xml");
pref("app.update.url.manual", "http://url.com/manual");
#!/bin/sh
# Script credit: Jeremy Reichman <jjracc@rit.edu>
# VolumeCheck Exit Statuses are calculated by subtracting 32
# E.G. exit 48 matches 16, exit 50 matches 18 in the VolumeCheck.strings file
# Check for minimum Mac OS X major version on the volume
SCRIPT_PATH="$0"
VOLUME_PATH="$1"
@rustymyers
rustymyers / getguid.pl
Created January 18, 2012 15:32 — forked from acidprime/getguid.pl
Using perl to parse plist data from dscl snippet, example using GeneratedUID
#!/usr/bin/perl
use Foundation;
my $NSASCIIStringEncoding = 1;
my $dscl = "/usr/bin/dscl";
sub getGeneratedUID(){
$name = shift;
my $command = "$dscl -plist . -read /Users/$name GeneratedUID";
print "$command\n";
my $output = `$command`;
@rustymyers
rustymyers / hack.sh
Created March 31, 2012 14:40 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
When you need to run a script against a volume that has not been restored first, you can set the $DS_LAST_RESTORED_VOLUME to the internal drive of the Mac. This allows a script to work with or without restoring in a workflow.
DS_LAST_RESTORED_VOLUME=`system_profiler SPSerialATADataType | awk -F': ' '/Mount Point/ { print $2}'|head -n1`