This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
# dump userlist using dscl and find accounts above UID 500 | |
def iterate_users | |
userlist=`/usr/bin/dscl . -list /users UniqueID`.split("\n").slice(1..-1) | |
newlist = userlist.map { |pair| pair.split(" ").to_a } | |
over500 = newlist.find_all { |item| item.at(1).to_i > 500 } | |
p over500 | |
end | |
iterate_users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
def iterate_users | |
userlist=`/usr/bin/dscl . -list /users UniqueID`.split("\n").map { |pair| pair.split(" ").to_a }.find_all { |item| item.at(1).to_i > 500 } | |
p userlist | |
end | |
iterate_users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
# 101221, nate | |
# attempt to fix perm/ownership issues on locally attached storage | |
# for some reason, these arrays were configured with ownership disabled | |
# | |
require 'osx/cocoa' | |
# get name of root volume, | |
# subtract it from array of total volumes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# get a machine's applecare warranty expiration | |
# 100605, nate, initial version | |
# 100605, updated with collaboration from glarizza | |
# cf. http://pastie.org/993496 | |
# cf. http://pastie.org/994884, with facter attribute additions | |
# 101222, require rubygems, facter; used facter to get serial (not as portable) | |
# 101222, reverted to system_profiler, as it requires fewer dependencies | |
# 110208, new url worked out by gary | |
# 110208, openssl workaround, cf. http://snippets.aktagon.com/snippets/370-Hack-for-using-OpenURI-with-SSL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
# 110224, revised with loop to accept an array | |
def get_version(apps) | |
apps.each do |app| | |
if File.exists?("#{app}/Contents/Info.plist") | |
vers = `/usr/bin/defaults read "#{app}"/Contents/Info CFBundleShortVersionString`.chomp | |
puts "#{app.sub(/\/Applications\//, '')}: #{vers}" | |
$?.success? ? vers : "ERROR: could not get version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
# capture users and uids, filtering for > 500 uids | |
# want to emulate dscl . -list /users UniqueID | awk '$2 > 500 { print $1 }' | |
def get_nonsys_users | |
users = `dscl . -list /users UniqueID`.split("\n").collect! {|u| u.sub!(/\ +/, ",").split(",").to_a}.select {|u| u[1].to_i > 500} | |
end | |
p get_nonsys_users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
def non_sys_users | |
users = `dscl . -list /users`.split("\n").reject { |user| user.match(/^_/) or ["n8","root","puppet","daemon", "Guest", "nobody"].include?(user) } | |
end | |
p non_sys_users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
# cf. http://twitter.com/nigelkersten/status/44114754112995328 | |
require 'pp' | |
require 'etc' | |
users = [] | |
Etc.passwd() { |u| | |
users << Hash[u.name, u.uid] if u.uid >= 500 | |
} | |
pp users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
errors on start: | |
Starting tomcat5: [ OK ] | |
at org.apache.catalina.startup.Catalina.await(Catalina.java:616) | |
at org.apache.catalina.startup.Catalina.start(Catalina.java:576) | |
... 6 more | |
Using CATALINA_BASE: /usr/share/tomcat5 | |
Using CATALINA_HOME: /usr/share/tomcat5 | |
Using CATALINA_TMPDIR: /usr/share/tomcat5/temp | |
Using JRE_HOME: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 110506 | |
# reposado clone manifest | |
# pythonversion comes from a custom fact which should be instaled via factsync | |
case $pythonversion { | |
/2.6/: { | |
# will this test actually succeed? | |
include reposado_install | |
} | |
default: { |
OlderNewer