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
@rustymyers
rustymyers / postflight
Created September 26, 2011 16:04
CreateUserLion fix for ARD
#!/usr/bin/python
#
# Payload free package to create a user on a 10.7 system.
import sys
import os
import re
import time
import subprocess
$ 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");
@rustymyers
rustymyers / getopsexample.sh
Created November 15, 2011 13:56
getops example
while getopts a:l? opt; do
case "$opt" in
a) variable="$OPTARG";;
l) list="LONG";;
h)
help
exit 0;;
?)
help
exit 0;;
#!/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`
CREATE TRIGGER movie_rental_insert On customer_rentals
FOR INSERT
AS BEGIN
UPDATE movies
SET num_rentals = num_rentals + 1
WHERE INSERTED.movie_id = movies.movie_id
END;
@rustymyers
rustymyers / gist:7786880
Created December 4, 2013 12:42
Trying to find out if the current users Kerberos ticket is the same principal as the kserver variable.
#include <stdio.h>
#include <gssapi.h>
#define kserver "dce.psu.edu"
//#define
#define minor_status
OM_uint32 CHECK_CRED(char *name) {
OM_uint32 gss_inquire_cred(
# 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