Permalink
Browse files

adding bulk of scripts

  • Loading branch information...
1 parent ba858ef commit b7bb425b1cf434b09a8fba6a6864834ef21fced3 @rustymyers committed Feb 11, 2011
Showing with 4,539 additions and 0 deletions.
  1. BIN applescript/ARD SSH Open.scpt
  2. BIN applescript/ARDSSH.scpt
  3. BIN applescript/CustomEntourageExchangeSetup3.1.0.scpt
  4. BIN applescript/Entourage Make tinyURL v1.2.2.scpt
  5. BIN applescript/Import Mial Exchange into iCal.scpt
  6. BIN applescript/addtext.scpt
  7. +150 −0 perl/LurkAndLaunch.pl
  8. +82 −0 perl/counter.pl
  9. +140 −0 perl/mailer.pl
  10. +61 −0 ruby/warranty.rb
  11. +50 −0 shell/AdminInventory.sh
  12. +1 −0 shell/Applescript Warning.sh
  13. +2 −0 shell/NAC Registration.sh
  14. +51 −0 shell/PackageInstaller.sh
  15. +35 −0 shell/RemoveLocalAdmins.sh
  16. +114 −0 shell/adduser.sh
  17. +131 −0 shell/adod-bind-login-leopard.sh
  18. +92 −0 shell/aida64.sh
  19. +34 −0 shell/annoy.sh
  20. +8 −0 shell/ardkick.sh
  21. +688 −0 shell/automysqlbackup.sh
  22. +46 −0 shell/batterycycles.sh
  23. +318 −0 shell/buildpackage.sh
  24. +351 −0 shell/cni_beta0.2.sh
  25. +22 −0 shell/cpmp3.sh
  26. +173 −0 shell/createemailaccount.sh
  27. +55 −0 shell/dailyarchives.sh
  28. +3 −0 shell/disableTMud.sh
  29. +4 −0 shell/dsn.sh
  30. +3 −0 shell/dvdregion.sh
  31. +3 −0 shell/fullnamechange.sh
  32. +17 −0 shell/genpassword.sh
  33. +242 −0 shell/growl.sh
  34. +9 −0 shell/hide.sh
  35. +4 −0 shell/ipv6off.sh
  36. +19 −0 shell/kerberosfix.sh
  37. +75 −0 shell/kinitGUI.sh
  38. +63 −0 shell/kinitdce.sh
  39. +7 −0 shell/laptopdesktoptest.sh
  40. +12 −0 shell/lpadmingroup.sh
  41. +52 −0 shell/makeuser.sh
  42. +43 −0 shell/messageUID3fix.sh
  43. +131 −0 shell/mkuser.sh
  44. +20 −0 shell/mkuser.sh - READ ME.sh
  45. +77 −0 shell/mountsysman.sh
  46. +126 −0 shell/netbootch.sh
  47. +6 −0 shell/officeversions.sh
  48. +185 −0 shell/osmaintain.sh
  49. +78 −0 shell/passpolicy.sh
  50. +4 −0 shell/remoteloginon.sh
  51. +24 −0 shell/savedoc.sh
  52. +4 −0 shell/screensaverauth.sh
  53. +4 −0 shell/screensharing.sh
  54. +4 −0 shell/setstartupdisk.sh
  55. +84 −0 shell/systemsetup.sh
  56. +12 −0 shell/times.sh
  57. +12 −0 shell/uninstallIDF3.sh
  58. +131 −0 shell/uninstallbes.sh
  59. +117 −0 shell/warranty.sh
  60. +360 −0 shell/wirelessadd.sh
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
@@ -0,0 +1,150 @@
+#!/usr/bin/perl
+
+########################################################
+my $SUAPP = "Software Update\.app";
+my $APP_IS_RUNNING = 0;
+########################################################
+
+open(PSOUT, "/bin/ps -awwx |");
+while( <PSOUT> ) {
+ if( /$SUAPP/ ) {
+ $APP_IS_RUNNING = 1;
+ }
+}
+close(PSOUT);
+
+if ( !$APP_IS_RUNNING )
+{
+ unless($ENV{'COMMAND_LINE_INSTALL'}) {
+ lurkAndLaunch( 'launchExpr' => "open '/Applications/Utilities/Power Mac G5 System Firmware Updater.app'" );
+ }
+}
+else
+{
+ our $RESOURCES = $ARGV[0]."/Contents/Resources";
+ our $TARGET = $ARGV[2];
+ our $HOME = $ENV{'HOME'};
+ our $USER = $ENV{'USER'};
+ our $APP = "/Applications/Utilities/Power Mac G5 System Firmware Updater.app";
+
+
+ #Only do this if we are installing to the boot volume
+ if ($TARGET eq "/")
+ {
+ #And we're authenticated as root
+ if ($< == 0)
+ {
+ #Go through each item in the startup app array, and find if $APP is in the list already
+ my $found = 0;
+ my $i = 0;
+ while (! $found)
+ {
+ my $invocation = qq{"$RESOURCES/PlistBuddy" } .
+ qq{"-c" "print AutoLaunchedApplicationDictionary:$i:Path" } .
+ qq{"$HOME/Library/Preferences/loginwindow.plist"};
+
+ my $path = `$invocation`;
+ my $errorCode = $? >> 8;
+
+ if ($errorCode != 0)
+ {
+ last;
+ }
+
+ chomp $path;
+
+ # PlistBuddy returns "Does Not Exist" when we hit the end of the array
+ if ($path =~ "Does Not Exist")
+ {
+ last;
+ }
+
+ if ($path eq $APP)
+ {
+ $found = 1;
+ }
+
+ $i ++;
+ }
+
+ # If $APP is not already there, add it!
+ if (!$found)
+ {
+ my $invocation = qq{"$RESOURCES/PlistBuddy" } .
+ qq{"-c" "add AutoLaunchedApplicationDictionary array" } .
+ qq{"-c" "add AutoLaunchedApplicationDictionary:0 dict" } .
+ qq{"-c" "cd AutoLaunchedApplicationDictionary:0" } .
+ qq{"-c" "add Path string '$APP'" } .
+ qq{"-c" "add Hide bool false" } .
+ qq{"-c" "add InstallerAdded bool true" } .
+ qq{"$HOME/Library/Preferences/loginwindow.plist" };
+
+ my $path = `/usr/bin/mktemp -d /private/tmp/install.XXXXXXXX`;
+ chomp($path);
+ my $ALWIscript = ($path . "/ALWI");
+
+ sysopen(SCRIPT, $ALWIscript, 0x0001 | 0x0200 | 0x0800) or exit 0;
+ print SCRIPT "#!/bin/sh\n\n";
+ print SCRIPT "$invocation\n\n";
+ close SCRIPT;
+
+ `/bin/chmod +rx "$path"`;
+ `/bin/chmod +rx "$ALWIscript"`;
+ `/usr/bin/su -m "$USER" -c "$ALWIscript"`;
+ system("/bin/rm", "-rf", "$path");
+ }
+ }
+ }
+}
+
+exit 0;
+
+sub lurkAndLaunch {
+ use Fcntl;
+ my %args = @_;
+ my $result = 0;
+
+ # make sure we have
+ if($args{'launchExpr'}) {
+ # Make sure the installer is running at this point
+ `/usr/bin/killall -s -m Installer >/dev/null 2>&1`;
+
+ if($? == 0) {
+ my $path = `/usr/bin/mktemp -d /private/tmp/install.XXXXXXXX`;
+ chomp($path);
+ my $lurkScript = ($path . "/lurker");
+
+ if($? == 0) {
+
+ if(sysopen(LURKER, $lurkScript, O_WRONLY | O_EXCL | O_CREAT)) {
+
+ my $scriptData = (
+ "#!/usr/bin/perl\n" .
+ "while(0 == system(\"/usr/bin/killall -s -m Installer >/dev/null 2>&1\")) {\n" .
+ " sleep(2);\n" .
+ "} \n" .
+ "system(\"$args{'launchExpr'}\");\n" .
+ "unlink(\"\$0\");\n"
+ );
+
+ print(LURKER $scriptData);
+
+ close(LURKER);
+
+ chmod(oct(500), $lurkScript);
+
+ if(0 == system("$lurkScript >/dev/null 2>&1 &")) {
+
+ $result = 1;;
+ }
+
+ } else {
+
+ print(STDERR "error opening temporary file!");
+ }
+ }
+ }
+ }
+
+ return($result);
+}
View
@@ -0,0 +1,82 @@
+#!/usr/local/bin/perl
+# A simple text-based hit counter
+# Doug Steinwand - dzs@iname.com
+# http://www.abiglime.com/webmaster
+
+# useage:
+# hitcounter.pl page_name
+# -- this option increments the hit count for the specified page
+# or
+# hitcounter.pl -summary
+# -- creates a html table summarizing hits from all pages
+#
+
+# location and name for the log file
+$LOGFILE="/home/dzs/1104/count.txt";
+
+# read the parameter
+$param=shift @ARGV;
+
+if (lc $param eq "-summary") {
+ display_summary();
+} elsif (length $param) {
+ print increase_hit($param);
+} else {
+ print "Usage: hitcounter.pl pagename\n";
+}
+
+exit 0;
+
+# displays a summary of all the pages
+sub display_summary {
+ open F, $LOGFILE or my_die("Can't open $LOGFILE: $!\n");
+ print "<h2>Summary</h2><table border=1>";
+ while (<F>) {
+ ($page,$count)=split(/\s+/);
+ print "<tr><td>$page</td><td>".(int $count)."</td></tr>\n";
+ }
+ close F;
+ print "</table><i>Generated ",
+ (scalar localtime(time)),"</i><br>";
+}
+
+# increments the hit count for the given page
+sub increase_hit {
+ my ($whichpage)=shift;
+
+ # local variables
+ my ($count,$pos);
+
+ # open or create the file
+ open F, "+<$LOGFILE"
+ or open F, ">$LOGFILE"
+ or my_die("Can't create $LOGFILE: $!\n");
+ # lock the file
+ flock F, 2;
+
+ $count=0; $pos=0;
+ # find the page name
+ while(<F>) {
+ ($page,$count)=split(/\s+/);
+ last if ($whichpage eq $page);
+ $pos=tell F;
+ $count=0;
+ }
+ # increment the count
+ $count++;
+
+ # rewind to start of the line
+ seek F, $pos, 0;
+
+ # write the data
+ printf F "%s %9.9d\n", $whichpage, $count;
+ close F;
+
+ # return the count without leading 0's
+ return int($count);
+}
+
+sub my_die {
+ print "<br>Error: @_<br>";
+ exit 1;
+}
View
@@ -0,0 +1,140 @@
+#!/usr/bin/perl
+#
+# mailer.pl-- A simple program to mail form data to an email address
+#
+# Written in 1997 by James Marshall, james@jmarshall.com
+# For the latest, see http://www.jmarshall.com/easy/cgi/
+#
+
+# IMPORTANT: MAKE SURE THESE TWO VALUES ARE SET CORRECTLY FOR YOU!
+$mailprog= "/usr/sbin/sendmail" ;
+$recipient= "rzm931@sunset.southhills.edu" ; # make sure to \ escape the @
+
+# Get the CGI input variables
+%in= &getcgivars ;
+
+# Open the mailing process
+open(MAIL, "|$mailprog $recipient")
+ || &HTMLdie("Couldn't send the mail (couldn't run $mailprog).") ;
+
+# Print the header information
+$ENV{'HTTP_REFERER'} || ($ENV{'HTTP_REFERER'}= "your Web site") ;
+print MAIL "Subject: Teacher Course Sign Up\n\n",
+ "The following data was entered at $ENV{'HTTP_REFERER'}:\n\n" ;
+
+
+# Find length of longest field name, for formatting; include space for colon
+$maxlength= 0 ;
+foreach (keys %in) {
+ $maxlength= length if length > $maxlength ;
+}
+$maxlength++ ;
+
+# Print each CGI variable received by the script, one per line.
+# This just prints the fields in alphabetical order. To define your own
+# order, use something like
+# foreach ('firstname', 'lastname', 'phone', 'address1', ... ) {
+foreach (sort keys %in) {
+
+ # If a field has newlines, it's probably a block of text; indent it.
+ if ($in{$_}=~ /\n/) {
+ $in{$_}= "\n" . $in{$_} ;
+ $in{$_}=~ s/\n/\n /g ;
+ $in{$_}.= "\n" ;
+ }
+
+ # comma-separate multiple selections
+ $in{$_}=~ s/\0/, /g ;
+
+ # Print fields, aligning columns neatly
+ printf MAIL "%-${maxlength}s %s\n", "$_:", $in{$_} ;
+}
+
+
+# Close the process and mail the data
+close(MAIL) ;
+
+
+# Print an HTML response to the user
+print <<EOF ;
+Content-type: text/html
+
+<html>
+<body>
+<h3>Your data has been sent.</h3>
+</body>
+</html>
+EOF
+
+exit ;
+
+
+#-------------- start of &getcgivars() module, copied in -------------
+
+# Read all CGI vars into an associative array.
+# If multiple input fields have the same name, they are concatenated into
+# one array element and delimited with the \0 character (which fails if
+# the input has any \0 characters, very unlikely but conceivably possible).
+# Currently only supports Content-Type of application/x-www-form-urlencoded.
+sub getcgivars {
+ local($in, %in) ;
+ local($name, $value) ;
+
+
+ # First, read entire string of CGI vars into $in
+ if ( ($ENV{'REQUEST_METHOD'} eq 'GET') ||
+ ($ENV{'REQUEST_METHOD'} eq 'HEAD') ) {
+ $in= $ENV{'QUERY_STRING'} ;
+
+ } elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
+ if ($ENV{'CONTENT_TYPE'}=~ m#^application/x-www-form-urlencoded$#i) {
+ length($ENV{'CONTENT_LENGTH'})
+ || &HTMLdie("No Content-Length sent with the POST request.") ;
+ read(STDIN, $in, $ENV{'CONTENT_LENGTH'}) ;
+
+ } else {
+ &HTMLdie("Unsupported Content-Type: $ENV{'CONTENT_TYPE'}") ;
+ }
+
+ } else {
+ &HTMLdie("Script was called with unsupported REQUEST_METHOD.") ;
+ }
+
+ # Resolve and unencode name/value pairs into %in
+ foreach (split(/[&;]/, $in)) {
+ s/\+/ /g ;
+ ($name, $value)= split('=', $_, 2) ;
+ $name=~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
+ $value=~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
+ $in{$name}.= "\0" if defined($in{$name}) ; # concatenate multiple vars
+ $in{$name}.= $value ;
+ }
+
+ return %in ;
+
+}
+
+
+# Die, outputting HTML error page
+# If no $title, use a default title
+sub HTMLdie {
+ local($msg,$title)= @_ ;
+ $title= "CGI Error" if $title eq '' ;
+ print <<EOF ;
+Content-type: text/html
+
+<html>
+<head>
+<title>$title</title>
+</head>
+<body>
+<h1>$title</h1>
+<h3>$msg</h3>
+</body>
+</html>
+EOF
+
+ exit ;
+}
+
+#-------------- end of &getcgivars() module --------------------------
Oops, something went wrong.

0 comments on commit b7bb425

Please sign in to comment.