Skip to content

Instantly share code, notes, and snippets.

View natewalck's full-sized avatar

Nate Walck natewalck

View GitHub Profile
@natewalck
natewalck / world_writable.rb
Created September 29, 2012 15:43
Even more of a dirty hack for Ruby World-writable test (1.8.7)
def world_writable?(file)
write_bit = Integer(sprintf("%o", File.stat(file).mode)[-1,1])
puts write_bit
if [2, 3, 6, 7].include?(write_bit)
true
else
false
end
end
<key>installer_choices_xml</key>
<array>
<dict>
<key>attributeSetting</key>
<integer>0</integer>
<key>choiceAttribute</key>
<string>selected</string>
<key>choiceIdentifier</key>
<string>quit</string>
</dict>
@natewalck
natewalck / server_speed_test
Created December 5, 2012 16:44
Script to test server speed
#!/usr/bin/ruby
require 'rubygems'
require 'mac-network/interface'
require 'mac-network/location'
include Mac::Network
require 'osx/cocoa'
require 'socket'
require 'time'
@natewalck
natewalck / gist:4255824
Created December 11, 2012 04:10
node setup
node 'deploystudioreplica01.paradise' {
include osx_netboot
}
@natewalck
natewalck / Asset.sh
Created January 4, 2013 16:14
removeiLife11.sh
#!/bin/sh
# start here
removables=(
"Applications/GarageBand.app"
"Applications/iMovie.app"
"Applications/iPhoto.app"
"Library/Application Support/GarageBand"
"Library/Audio/Apple Loops"
@natewalck
natewalck / gist:4630440
Created January 25, 2013 00:43
ZNC patch
# patch -p1 < znc-query-buffering.patch
patching file IRCSock.cpp
Hunk #1 FAILED at 724.
1 out of 1 hunk FAILED -- saving rejects to file IRCSock.cpp.rej
patching file User.cpp
Hunk #1 FAILED at 290.
1 out of 1 hunk FAILED -- saving rejects to file User.cpp.rej
@natewalck
natewalck / labstatspostflight.sh
Last active December 12, 2015 08:59
luggage post part 1
#Step 3: Create necessary directories
sudo mkdir "/Applications/LabStats"
sudo mkdir "/Library/Application Support/LabStats"
#Step 4: Copy files to correct location
sudo cp -r "$1/Contents/Executable/" "/Applications/LabStats"
sudo cp -r "$1/Contents/Bundles/" "/Applications/LabStats"
sudo cp "$1/Contents/Launch Daemon/LabStats.plist" "/Library/LaunchDaemons"
sudo cp "$1/Contents/Launch Agent/LabStats.plist" "/Library/LaunchAgents"
sudo cp "$1/host.txt" "/Library/Application Support/LabStats"
@natewalck
natewalck / gist:4748110
Last active December 12, 2015 08:59
Labstats Makefile for Luggage
LABSTATS_PACKAGE_NAME="LabStats 5 Client.pkg"</pre>
prepare-files: l_Applications l_Library_Application_Support
# Created necessary directories and copies the files into them
@sudo mkdir -p ${WORK_D}/Applications/LabStats
@sudo mkdir -p "${WORK_D}/Library/Application Support/LabStats"
@sudo ${CP} -R ./${LABSTATS_PACKAGE_NAME}/Contents/Executable/ ${WORK_D}/Applications/LabStats/
@sudo ${CP} -R ./${LABSTATS_PACKAGE_NAME}/Contents/Bundles/ ${WORK_D}/Applications/LabStats/
pack-labstats: prepare-files l_Library_LaunchDaemons l_Library_LaunchAgents
# Fix permissions on the installed files
@natewalck
natewalck / gist:4748129
Created February 10, 2013 02:41
Labstats Postflight Continued
#!/bin/bash
#Step 1: Kill any exising processes
sudo killall mono
sudo killall LabStatsClient
#step 1.5 Stop any agents.
launchctl unload /Library/LaunchDaemons/LabStats.plist
#launchctl unload -D all /Library/LaunchAgents/LabStats.plist
#launchctl unload /Library/LaunchAgents/LabStats.plist
@natewalck
natewalck / gist:4748134
Created February 10, 2013 02:45
DeployStudio Warranty Variables
SERIAL_NUMBER
PURCHASE_DATE
WARRANTY_EXPIRES
WARRANTY_STATUS
MODEL_TYPE
ASD