Author Archives: lagreca

Screen Sharing hack for OSX

Here’s an easier way to share the screens of other Macs on your network. The screen sharing feature is just an application. It resides in /System/Library/CoreServices/Screen Sharing.app.  You can drag that to your dock for easy access.

If you launch it now, you will get a box asking you for the IP address of the machine you want to connect to.  But if you want to simplify things, you can use Bonjour to show you a list of all machines on your local network.  You will need to launch terminal and enter:

defaults write com.apple.ScreenSharing ShowBonjourBrowser_Debug 1

When you launch Screen Sharing.app you will be presented with a graphical list of computers available on your local network.

NOTE:  This functionality has been removed/broken in Snow Leopard!

Source:  http://www.macworld.com/article/131094/2007/12/screensharepower.html

Snow Leopard arrives vulnerable

In Snow Leopard, Apple downgraded the installation of Flash to an earlier version (version 10.0.23.1), which is known NOT to be secure and is NOT patched against various security vulnerabilities.

You should update to the latest version immediately:  http://get.adobe.com/flashplayer/

This is a simple update:

  • Download the latest flash version
  • Close your browsers
  • Run flash installer
  • Your are done!

Apple Snow Leopard updates/changes

This list is NOT comprehensive or complete.  Its just the changes I have observed or find interesting.

  • Change search locations.  Change the default behavior of Spotlight to have it search the currently selected folder or your most recent search location. Go to Finder -> Preferences -> Advanced -> change “When performing a search:” to “Search the current folder”.
  • Spell checker in TextEdit.  Can be controlled in TextEdit preferences.
  • Airport menu now shows signal strength of available wireless networks.
  • Minimize apps onto their doc icon, instead of the right side of the doc. Go to Apple Menu -> System Preferences -> Dock -> select “Minimize windows into application icon”.
  • Activate Expose from the dock:  Click and hold an application icon in the Dock and all the windows for that application will unshuffle so you can quickly change to another one.
  • Expose shortcuts:  With all windows visible in Expose, you can press Command-1 to arrange the windows by name or Command-2 to arrange them by application. Pressing the Tab key will cycle through all the running applications. Press the spacebar while pointing at a window to expand it.
  • Expose windows are now highlighted with a blue outline when mouse over.
  • More reliable disk eject.
  • Restore deleted items to original folders.
  • Scroll though stacks and navigate folders in stacks.
  • Faster shutdown and wake-up.
  • HFS+ read support in Boot Camp.
  • Screen recording functionality built into Quicktime Player.  Seems to only support the main screen, not external monitors.
  • Date in menu bar.d
  • Screen saver shuffle.
  • Multi-Touch gestures in older Mac models.
  • Preview intelligent text selection.
  • Location awareness:  Snow Leopard can determine your time zone from information provided by your Wi-Fi hotspot – in your Date & Time preferences, choose Time Zone, and tick Set Time Zone Automatically
  • Descriptive Screenshot filenames: Instead of “Picture 1,” you now get “Screen shot 2009-09-04 at 11.26.49 AM”  (It seems they didn’t follow this same goodness with their screencast recordings.  Always hope for their next patch?)

Here is what broke on my upgrade:

  • Little Snitch
  • iStat Menus

One year after switching to a Mac…

Just like the saying says, 3rd time is a charm.  I tried switching to Mac two times before the final time.  I am now a full fledged mac user, and am quite happy.  Here is a list of things I like and dis-like:

Likes:

  • OS is very stable and smooth and does not slow down between reboots
  • faster reboots, shutdowns, sleep and wake
  • iPhoto is great for managing all of our digital photos
  • iMovie is great for making home movies from all of our video clips
  • terminal with a familiar set of linux commands (ssh, rsync, etc)
  • disk utility for managing disks (partitions, formatting, re-sizing, etc)
  • time machine is GREAT for no brainer backups
  • AdiumX is much better than Gaim or Pidgin
  • preferences are all stored in files instead of a registry
  • spotlight and quicksilver
  • VNC is built into the OS
  • File sharing is easy and make sense in P2P networks
  • switching computers is no longer an all day affair.  Either use migration assistant or restore from a time machine backup.
  • switching hard drives is simply done by using disk utility to copy all files to the new drive.
  • expose is great way to view all your open windows, desktop , or just a particular applications windows.
  • The mac can be on multiple subnets simultaneously with just one NIC (Windows can have multiple IP’s on a NIC, but they have to be on the same subnet).
  • software installs are often times as simple as copying the application to your applications folder
  • playing music from remote itunes libraries is easy (unfortunately, this does NOT mean copying music, ONLY playing it).
  • growl is a great 3rd party notification system

Dis-Likes:

  • inconsistent user interface.  Example:  Sometimes closing a window closes the app.  Other times when closing a window the app remains running.
  • wireless seems slower than on pc’s
  • mac file droppings left all over (solution for network shares:  http://support.apple.com/kb/HT1629) (solution for local drives: http://www.zeroonetwenty.com/blueharvest/)
  • not able to cut and paste files to move them around the file system, must have two windows open and drag files/folders between them.
  • pressing enter when something is selected changes the name, it does not open it
  • no GUI application like putty to manage ssh sessions
  • no notepad++ like application for editing text files
  • no Chrome browser for Mac yet…
  • when looking for wireless networks to connect to, Leopard does NOT display signal strength, just network name (solved in snow leopard).

Using Google Reader “Send To” with Gmail

Here is how to use the new “Send To” feature, in google reader, to send items directly to a new Gmail email.

To set this up, go to Google Reader and open Settings. Select the “Send To” tab and click on the “Create a custom link” button.  Fill in with this information:

  • Name:  Email
  • URL:  mailto:?subject=${title}&body=${title}%0A%0A${url}
  • Icon URL:  http://mail.google.com/mail/images/favicon.ico

Example:

gr_sendto_gmail_example

Using Google Reader “Send To” with WordPress

Here is how to use the new “Send To” feature, in google reader, to send items directly to a new WordPress post.  (make sure to replace with your own domain name!)

To set this up, go to Google Reader and open Settings. Select the “Send To” tab and click on the “Create a custom link” button.  Fill in with this information:

  • Name:  Whatever name you want the action called in google reader
  • URL:  http://www.yourdomain.com/wp-admin/press-this.php?u=${url}&t=${title}&s=${source}&v=2
  • Icon URL:  http://s.wordpress.org/favicon.ico?3

Example:

gr_sendto_example

via Using Google Reader “Send To” with WordPress | thingelstad.com.

Mac Screen Capture Shortcuts

Screen Capture Shortcuts

  • Command-Shift-3:  screen capture of your entire screen, save to your desktop
  • Command-Shift-4:  crosshair cursor so you can choose which area of the screen you want to capture, save to your desktop
  • Adding Control to either of these commands copies the capture into your Clipboard memory, so you can paste it where you want.

via Apple – Pro – Tips – The Secret Screen Capture Shortcut.

How to install and use sshfs using MacFUSE

I wanted to create a secure drop box to my website and decided to try sshfs.

I had MacFuse already installed from using NTFS-3G.

  • Download and install sshfs.
  • Double click the gz file you downloaded to extract and rename it to sshfs.
  • Move the sshfs application to /usr/local/bin/
    • Go to Finder, Go, Go to folder…
    • type in:  /usr/local/bin/
    • Drag the sshfs app to the folder
    • Finder will ask you to authenticate, so type in your password
  • Now you need to change the permissions on the sshfs file so it is executable.
    • Launch Terminal
    • cd /usr/local/bin/
    • ls -al to see files and permissions
    • To change the permissions:  chmod 755 sshfs
    • To change the owner and group:  sudo chown root:wheel sshfs

Now you can use sshfs to mount your remote shares.  I created a script to initiate the mount, but obviously this can be used at the command line. For usage options type:  sshfs -h

Here is my script:

umount /Volumes/Domain.com

rmdir /Volumes/Domain.com

mkdir /Volumes/Domain.com

sshfs [email protected]:path/uploads/ /Volumes/Domain.com/ -o auto_cache -o local -o volname=Domain.com

Here is what happens:

  • unmount anything that may exist in /Volume/Domain.com
  • delete any Domain.com folder that exists in /Volumes
  • create /Volumes/Domain.com to mount the remote file system into
  • finally mount the remote file system

Caveat:  sshfs does NOT do file locking, therefor it would NOT be good to use in a multi-user environment.  You can, but you will more than likely run into problems.

Linux shell script to monitor disk space

Problem:  Hard drives can fill up, and when they do, no good can come of it.  Wouldn’t you like to be notified before impending disaster so you can correct the situation?

Solution:  Here is a simple script that I put in /etc/cron.hourly (would probably be better in cron.daily, but I’m overly paranoid)

#!/bin/sh
# set -x
# Shell script to monitor or watch the disk space
# It will send an email to $ADMIN, if the (free available) percentage of space is >= 90%.
# ————————————————————————-
# Set admin email so that you can get email.
ADMIN=”[email protected]
# set alert level 90% is default
ALERT=80
# Exclude list of unwanted monitoring, if several partions then use “|” to separate the partitions.
# An example: EXCLUDE_LIST=”/dev/hdd1|/dev/hdc5″
EXCLUDE_LIST=”/boot”
#
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#
function main_prog() {
while read output;
do
#echo $output
usep=$(echo $output | awk ‘{ print $1}’ | cut -d’%’ -f1)
partition=$(echo $output | awk ‘{print $2}’)
if [ $usep -ge $ALERT ] ; then
echo “Running out of space \”$partition ($usep%)\” on server $(hostname), $(date)” | \
mail -s “Alert: Almost out of disk space $usep%” $ADMIN
fi
done
}

if [ “$EXCLUDE_LIST” != “” ] ; then
df -H | grep -vE “^Filesystem|tmpfs|cdrom|${EXCLUDE_LIST}” | awk ‘{print $5 ” ” $6}’ | main_prog
else
df -H | grep -vE “^Filesystem|tmpfs|cdrom” | awk ‘{print $5 ” ” $6}’ | main_prog
fi

Download:  diskalert.sh

Credit:  http://www.cyberciti.biz/tips/shell-script-to-watch-the-disk-space.html