OSX turn off or delay hibernate

Apple’s Mac OSX hibernate can be delayed indefinitely or turned off by issuing this terminal command.

[code]
sudo pmset -a hibernatemode 0
[/code]

To get back to default normal hibernate mode type this terminal command.

[code]
sudo pmset -a hibernatemode 3
[/code]

So the word is this won’t disable hibernate on battery failures. Haven’t tested, hope I won’t have to.

Here’s the source article http www frederico araujo…

Here’s the source article:
http://www.frederico-araujo.com/2011/07/30/installing-rails-on-os-x-lion-with-homebrew-rvm-and-mysql/

My goals here are to update an environment and move to a new Susy release: http://susy.oddbird.net/

1. Install and upgrade XCode from the Mac App Store (4.3.2 in this case). Also install the Command Line Tools found in the Preferences pane.

2. Install Homebrew. Not entirely necessary, but I’m enjoying it lately.

[bash]
Install Homebrew Package Manager
$ /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"

[/bash]

3. Install RVM – Ruby Version Manager
[bash]
// Install RVM
$ bash -s master < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
// Reset some paths
$ echo ‘[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function’ >> ~/.bash_profile
// Run to reset your open terminals
$ source ~/.bash_profile
// Make sure RVM is updated
$ rvm get stable
// Had to do a reinstall for Ruby stable
$ rvm reinstall 1.9.3-p194
// Use Ruby 1.9.3-p194
$ rvm use 1.9.3-p194 –default
// Check my ruby version
$ ruby -v
[/bash]

4. Install Compass
[bash]
// Make sure all is good
$ sudo gem update –system
// Some XML Tools
$ sudo gem install builder
// Install Compass
$ sudo gem install compass
// Here’s where things went wacky, so Installed the kitchen sink – over-install-panic-attack!
$ sudo gem install haml
$ sudo gem install haml-edge
$ sudo gem install rails
// Oh it’s a damn bug see:
// http://stackoverflow.com/questions/10610254/cant-install-compass-via-rvm
$ rubygems-bundler-uninstaller
// Test Compass
$ compass version
[/bash]

5. Install my favorite Compass add-ons
[bash]
// Oily_PNG to for sprite creation performance
$ sudo gem install oily_png
// Susy because grids are awesome – Now this will install some alpha SASS and Compass code but why not.
$ sudo gem install susy –pre
// Normailze CSS sortof-reset
$ sudo gem install compass-normalize
[/bash]

Mac OSX 10.6 Shell Script to Configure, Launch, and Shutdown Screen Sharing

Apple’s MacOS has a tidy built in remote access client and service generically known as “Screen Sharing”. Yay! This works great for headless machines, testing servers, and annoying your spouse. The paranoid and performance conscious user may not want these services continuously running. Rogue services hanging out, listening, and waiting for some punk to probe them in an Internet dark alley. This cobbled together shell script might be for you!

This shell script has four simple commands (I use sudo because I really should):

  • # sudo ./share-screen.sh start
  • # sudo ./share-screen.sh stop
  • # sudo ./share-screen.sh allow {username}
  • # sudo ./share-screen.sh deny {username}

I use this in terminal. Make sure you put a copy of this script on the target machine and make it executable. First I make sure that Remote Login is active on the target computer. It’s under Sharing in System Preferences. Then I login remotely using ssh. I fire up the script, activate Screen Sharing, do my business, shutdown Screen Sharing, log off, and go home.

Of course, no warranty, no guaranty. Good Luck!

[shell]
#!/bin/bash

if [ $# == 0 ]; then
echo "Commands: start, stop, allow <username>, deny <username>"
exit
fi

case "$1" in
start)
echo ‘Starting Remote Access’
# Activate Apple Remote Access with current settings
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate
;;
stop)
echo ‘Stopping Remote Access’
# Deactivate Apple Remote Access
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -stop
;;
allow)
if [ -z "$2" ]; then
echo "ERROR: Provide a valid user"
exit
fi
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -specifiedUsers
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -access -on -privs -all -users ${2}
;;
deny)
if [ -z "$2" ]; then
echo "ERROR: Provide a valid user"
exit
fi
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -specifiedUsers
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -access -off -privs -none -users ${2}
;;
esac
[/shell]

I almost forgot. Credit where credit is due! Inspiration from these articles and resources:

http://www.macosxhints.com/article.php?story=20080318190503111

https://rentzsch.tumblr.com/post/515009165/starting-vnc-remotely-via-kickstart

My Reply to E-mail with Text File AppleScript

At work I deal with a large volume of e-mail. There just aren’t enough people to handle all the e-mail requests or questions. When I have people to help handle e-mail, I still answer some of the same questions over and over and over. You just don’t want to know the volume or scope of my daily e-mail chores.

As a long time MacOS user I have repeatedly turned to AppleScript as a useful tool for dealing with making the same e-mail replies constantly (the real solution is to fix the breakdown in communication, but that’s a whole other story). Here is the most recent incarnation of my AppleScript solution using Apple Mail on MacOS 10.6.

My solution is simple; Highlight the message, run the script, select a pre-written text file to include, customize the reply, and send. The respondent gets a solution or reply that is usually edited over time for clarity, and I get to customize it a bit so it doesn’t seem too much like an auto-reply.

[applescript]
tell application "Mail"

set theSelection to selection
set theSelectedMessage to item 1 of theSelection
set theSelectedMessageSender to sender of theSelectedMessage

set theSelectedMessageSenderName to extract name from sender of theSelectedMessage
set theSelectedMessageSenderAddress to extract address from sender of theSelectedMessage

set theSelectedMessageSubject to subject of theSelectedMessage
set theSelectedMessageContent to content of theSelectedMessage

set myHomeDefault to the path to home folder
set myHomeDefault to myHomeDefault & "nicholls:Documents:e-mail_templates:" as text
set myHomeDefault to myHomeDefault as alias

set myTemplateFile to (choose file with prompt "Select E-mail Template File:" of type {"TEXT"} default location myHomeDefault)

open for access myTemplateFile
set prefsContents to read myTemplateFile using delimiter {"#–#"}
close access myTemplateFile
set MessageText to item 1 of prefsContents

set theMessage to make new outgoing message with properties {visible:true, subject:"Re: " & theSelectedMessageSubject, content:MessageText & theSelectedMessageContent}
tell theMessage
make new to recipient at end of to recipients with properties {name:theSelectedMessageSenderName, address:theSelectedMessageSenderAddress}
make new bcc recipient at end of bcc recipients with properties {name:"Website Manager", address:"nichweb@nicholls.edu"}
end tell
end tell
[/applescript]

This is a sample text file I might use. I made this really basic. You should note the #–# deliminator used. I have that so I can do some other interesting things with the templates, like BCC: my boss if I have too. Anyway this would be saved something like email-reply-standard.txt and I would load it through the dialog created by the script when it runs.

[plain]
Thank you for your interest!

If you have further questions, please let me know.

Jess Planck

  • —————————
    Nice Signature with phone
    —————————
    Probably has the website too
        • [ Your Original Message Follows ]—-

#–#
[/plain]

For some reason the syntaxhighligher I’ve got here doesn’t like AppleScript comments, so I’ve removed them.