Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Automatically restart Logmein Hamachi Internet
If you are having trouble with Logmein Hamachi starting up correctly, the following script will check to see if the connection is up. If it is, it will attempt to restart and then send you an email when it's done.

You'll need to update these variables with your own data:
email_address='XXXXXXX@gmail.com'

hamachi_network="xxx-xxx-xxx"
Also update the machine names and IP address (e.g. test_ip_address) in the case statement.

You can use the command hamachi list (from a Terminal window) to get your network ID and IP addresses.

Once you set this up, you can run this from any of your connected machines and it will try to connect to the other machine. If it cannot, it attempts to get Hamachi working again.

Here's the script:
#!/bin/bash
# Script to restart the Hamachi connection if it is not working
#
# user command "hamachi list" to find the hamachi network you are connecting to
#
 
email_address='XXXXXXX@gmail.com'
hamachi_network="xxx-xxx-xxx"
public_ip_address='google.com'
 
#
 
machine_name=`uname -n`
case $machine_name in
 
        Mac1.local)  test_ip_address="25.xxx.xxx.xxx"
                        test_machine="Mac1"
                        ;;
 
        Mac2.local) test_ip_address="25.xxx.xx.xx"
                        test_machine="Mac2"            
                        ;;      
        *) echo "You are using an unknown machine, named [$machine_name]. Exiting"
           exit
        ;;
esac
 
echo "Checking Logmein Hamachi network connectivity..."
echo "You are using [$machine_name]. Checking IP Address [$test_ip_address] on [$test_machine]"
IS=`/sbin/ping -c 5 $public_ip_address 2> /dev/null | grep -c "64 bytes"`
if (test "$IS" -eq  "0") then
   echo "Your internet connection does not appear to be working. Aborting check"
   exit
fi
 
IS=`/sbin/ping -c 5 $test_ip_address 2> /dev/null | grep -c "64 bytes"`
if (test "$IS" -gt "2") then
   echo "Your Logmein Hamachi connection appears to be working."
   exit
else
   echo "There appears to be a problem with your Logmein Hamachi connection."
   echo "I will check again in 10 seconds..."
   sleep 10
   IS=`/sbin/ping -c 5 $test_ip_address 2> /dev/null | grep -c "64 bytes"`
   if (test "$IS" -gt "2") then
       echo "Your Logmein Hamachi connection appears to be working now."
       exit
   else
       echo "There is still a problem with your Logmein Hamachi connection. Attempting to fix by restarting Logmein Hamachi..."
       hamachi logout
       sleep 10
       hamachi login
       sleep 10
       hamachi go-offline $hamachi_network
       sleep 10
       hamachi go-online $hamachi_network
       echo "OK, we should be back up!"
       echo "Your Logmein Hamachi connection on $machine_name needed to be cycled on/off.
 
Could not connect to [$test_ip_address].
 
It may also mean that $test_machine is down." | mail -s "Hamachi Connection Down on $(date '+%m/%d/%y @ %H:%M:%S')" $email_address -f ipdown@no-reply.com -F "Hamachi Connection Problem on $machine_name"
   fi
fi

[crarko adds: I haven't tested this one.]
  Post a comment  •  Comments (1)  
  • Currently 1.20 / 5
  You rated: 2 / 5 (10 votes cast)
 
[8,375 views] Email Article To a Friend View Printable Version
Split WordPress XML files for upload to servers Internet
I've been doing some work on my website, Kirkville, changing to a new theme. In order to test the theme, I set up a staging server, and wanted to import my existing posts, comments, etc. so I could fiddle with the new theme.

I'm not SQL-savvy, so it seemed the best bet was to use WordPress's export/import feature, through its wordpress-importer plugin. This requires exporting an XML file of the WordPress content from the current server, then importing it on the staging server. Unfortunately, I was hit by that problem where my hosting company has uploads limited to 8 MB, and my WordPress XML file was 10.9 MB.

When I went looking for solutions, I found a number of posts on the WordPress forum suggesting splitting the XML file. I wasn't sure how to do this safely, but found a free Mac utility called WXR Splitter. Running this tool, I split the XML file into two pieces, with a maximum of 6 MB each. I was able to upload the XML file, and get to work with my new theme.
  Post a comment  •  Comments (1)  
  • Currently 2.00 / 5
  You rated: 1 / 5 (5 votes cast)
 
[6,429 views] Email Article To a Friend View Printable Version
Use Flickr as a cloud drive Internet
Flickr has announced that all users will now have 1 TB of storage for free. With that much space, surely it would be interesting to figure out how to use Flickr as a cloud drive.

Ricardo Tomasi has done just that with Filr, a command-line tool that turns Flickr into a storage repository. This solution isn't ideal, since it's only available for now from the command line, and has only been tested with certain types of files (images), and only on files of up to 15 MB. But it's worth highlighting, and I'm sure others will come up with better solutions very soon.

Note: this may violate Flickr's Terms of Service. Use at your own risk.
  Post a comment  •  Comments (8)  
  • Currently 2.13 / 5
  You rated: 1 / 5 (8 votes cast)
 
[16,171 views] Email Article To a Friend View Printable Version
Renew a DHCP lease Internet
Renewing a DHCP lease via the Network System Preference Pane has the advantage of not dropping the connection, unlike switching the interface to BOOTP and back to DHCP. This command mimics that behavior.

It seems that the button creates a key in SystemConfiguration that notifies it to refresh the configuration. We can create that key using the following command (changing en0 for the relevant interface):
echo "add State:/Network/Interface/en0/RefreshConfiguration temporary" | sudo scutil
It has the desired effect on 10.4 through 10.8 – I didn't have access to anything older.
  Post a comment  •  Comments (4)  
  • Currently 3.50 / 5
  You rated: 4 / 5 (12 votes cast)
 
[7,360 views] Email Article To a Friend View Printable Version
Add URLs to Reading List automatically from e-mails Internet
This is an update to this hint, Automatically add links from Emails, Twitter or Google Reader to Reading List . I found the solution posted there to be insufficient. The script only allows URLs to be on their own full line, whereas my solution scans the entire message for links everywhere. As long as they are separated by a space the script should find them. WebKit users can even set their own browser.

I hope this helps replace some "read later services" by Reading List.

Save the script below to ~/Library/Application Scripts/com.apple.mail/ and assign it to a new Mail rule.

An easier way to send yourself links is by adding +reading to your mail address. If your normal address is myaddress@gmail.com, it would become: myaddress+reading@gmail.com.

The beauty of this is that you can add this address to your Contacts and give it a nice name like “Add to Reading List”. The previous hint required editing e-mail subject lines in a predefined way. Apps like Reeder are able to send to a default mail address. With this, set the +reading address to be your default address, share via e-mail, tap Send, and it's done.

Set up a new rule with the following options:

  • Rule: “any recipient contains ‘+reading’”
  • Actions:
    • “mark as read”
    • “execute AppleScript” (this script)
    • “delete message"
    • “stop evaluating rules”

Here’s the script (you can also get it on GitHub):

(*
Add to Reading List

Script for Apple Mail to find http and https links in emails and add them to Safari's Reading List automatically.

Best practice: setup with "any recipient contains '+reading'". 
Actions "mark as read", "execute AppleScript", "delete message", "stop evaluating rules"

Created by Andreas Zeitler on 2012-10-07
*)

using terms from application "Mail"

    set theURLs to {}

    on perform mail action with messages theMessages

        try
            set theMessageCount to count of theMessages
            repeat with theMessageIndex from 1 to theMessageCount
                set theMessageContent to content of (item theMessageIndex of theMessages)

                -- find URLs in messages
                set cmd to "echo \"" & theMessageContent & "\" | egrep -o -e 'http[s]?://\\S+' | sed 's/[<>]//'"
                set theURLs to do shell script cmd

                -- make URLs a list
                set theURLs to paragraphs of theURLs

                -- add URLs to reading list
                my addToReadingList(theURLs)

            end repeat
        end try

    end perform mail action with messages
end using terms from

on addToReadingList(theURLs)

    -- set your preferred browser. Use "Safari" or "WebKit"
    set myBrowser to “Safari”

    using terms from application "Safari"
        tell application myBrowser
            repeat with theUrl in theURLs
                add reading list item theUrl as string
            end repeat
        end tell
    end using terms from
end addToReadingList
  Post a comment  •  Comments (0)  
  • Currently 4.67 / 5
  You rated: 4 / 5 (6 votes cast)
 
[6,065 views] Email Article To a Friend View Printable Version
Back up blog or FTP directory with AppleScript Internet
All those many different WordPress plugins to back up my blog looked too daunting to me, so I decided to create my own simple Mac-native solution using AppleScript. This AppleScript does the following:
  1. Simulates a double-click on the alias to my web server (where my WordPress blog lives) to mount it as a WebDAV volume (just like iDisk)
  2. Runs the handy Unix backup command rsync to copy the remote contents locally
  3. Unmounts my web server

I then set up a daily iCal event to run the script at 4 a.m. Since I already have CrashPlan backing up my hard drive, that takes care of archiving periodic versions of the backup, just in case.

Here's the script:

set filepath to "Macintosh HD:Users:USERNAME:Library:Favorites:www.example.com"
tell application "Finder" to open filepath
delay 30

do shell script "rsync -av /Volumes/www.example.com/blog/ '/Volumes/Backup/wordpress-backup'"

tell application "Finder" to eject "www.example.com"
Set you own user name, domain and backup destination in the script.

[kirkmc adds: While this is a simple solution, I think it's good to remind people how easy it is to back up a server with rsync. While the submission mentions WordPress blogs, this can be used for any server directory. It's worth reading an older hint about using rsync for backups and a much older (from 2003) detailed walkthrough of creating backups using rsync.

It's also worth pointing out that while there are many WordPress backup plug-ins available, it is also a good idea to use one. The backup in this hint only backs up files, not the actual WordPress database. I use the WP-DBManager plug-in for automatic backups of my database, that are sent to me by e-mail.]
  Post a comment  •  Comments (3)  
  • Currently 3.25 / 5
  You rated: 2 / 5 (4 votes cast)
 
[5,768 views] Email Article To a Friend View Printable Version
Migrate iWeb blog to WordPress Internet
I had to migrate my personal blog about my 2-year old daughter from MobileMe servers to a WordPress account. I wanted to keep all the comments, as well as my posts and other content. So I wrote a perl script to do the job. It is far from beeing perfect, but it works for me. You will have to change some settings in the script to get it to work for you.

Features:
  • Keep comments
  • Keep images (mostly)
  • Sets e-mail adresses for comments by name
  • Sets tags by text strings found in title or body


Note: The script will only work as long as Apple's servers are active (through June 30, 2012).

Tips: 1. Import to WordPress first without images. 2. Import the same file again with images. 3. If you can, adjust running time for scripts on your hosting service.

[kirkmc adds: I have no way of testing it, never having created a site with iWeb. Look carefully at the script and check for what variables you need to set. Obviously, there is no risk, as you'll simply be converting from your iWeb site to WordPress, but make sure you keep backups of everything anyway. It would be good if someone could post in the comments whether it works for them or not. Save the script as a .pl file before running it.]
read more (1,936 words)   Post a comment  •  Comments (2)  
  • Currently 3.75 / 5
  You rated: 5 / 5 (4 votes cast)
 
[13,102 views] Email Article To a Friend View Printable Version
How to connect to a WPA-PSK/WPA2-PSK wireless network Internet
When you want to join a WPA-PSK/WPA2-PSK wireless network, your Mac will always refuse to do so. Here's how you can do it.

In System Preferences, click on the Network icon, then on Wi-fi in the list of networks. Click on the "Advanced..." button at the bottom-right of the window. On the Wi-Fi tab, click on the plus (+) button, then add the following:
  • Network Name: Your Wi-Fi network's SSID Name
  • Security: Any (Personal)
  • Password: Your Wi-Fi password
Then click on OK. (You may need to enter your administrator's password to apply the changes.)

Now your Mac will automatically connect to your WPA-PSK/WPA2-PSK network.

[kirkmc adds: I haven't tested this. What I understand here is that you cannot connect to this type of network via the standard dialog, and you must simply add it manually to your list of networks.]
  Post a comment  •  Comments (23)  
  • Currently 2.00 / 5
  You rated: 4 / 5 (17 votes cast)
 
[78,235 views] Email Article To a Friend View Printable Version
10.7: Check web pages without using a browser Internet
Using a saved Internet location on your desktop, you can quickly check a web page without opening a browser window.

This is a handy way to keep an eye on websites without having to manage browser windows or tabs. Simply drag the URL address from the the top of your browser window (I use Safari) onto your desktop. A 'web internet location' file is created. Now just use Quick Look (hit spacebar) to see a live view of the web page. You can even click a link, which then opens in your default browser.

Take it to the next level: Create a folder with all your favorite internet location files. Put the folder in your dock. Now when you hover over the file in grid or fan view, you can tap space bar to see the web page, and use the arrow keys to navigate around (list view doesn't Quick Look, for some reason, and only opens into a browser). I don't have Flash installed on my system, but I'm curious to know if YouTube and other Flash sites will run within Quick Look. Hope some people find this handy.

[crarko adds: 10.7 only. It looks like Quick Look uses Webkit to render the page, so you in effect are using a browser, just not a separate application. Flash did load when I tried this, in fact it seems to have bypassed ClickToPlugin (a Safari extension) in order to do so.]
  Post a comment  •  Comments (1)  
  • Currently 3.78 / 5
  You rated: 4 / 5 (9 votes cast)
 
[3,906 views] Email Article To a Friend View Printable Version
Share an Airport connection with iPad via Bluetooth Internet
This is a useful hint if you have a Mac and an iPad (or iPod touch), and you want to share a hotel wireless Internet connection with both devices.

In the System Preferences Bluetooth pane, pair your Mac with your iPad (they don't need to be connected yet, just paired). Then, select the iPad in the list of Bluetooth devices, and click the Advanced button. Check the 'Share my Internet connection with other Bluetooth devices' option. This should switch you to the Network preferences pane and prompt you to create a new Bluetooth PAN device.

Now go to the Sharing preferences pane and select Internet Sharing from the services list. Under 'Share your connection from,' select Airport, and under 'to computers using,' select Bluetooth PAN. Then check the checkbox next to Internet Sharing in the services list to enable Internet sharing.

From the iPad's Settings app in the General pane, tap Bluetooth, and connect to your Mac. In the top left corner, in place of the Wifi signal strength indicator, you should see a pair of interconnected rings indicating that you are connected to your Mac.

When you bring up a new page in Mobile Safari, you might be prompted by the hotel's ISP to select billing options on the iPad; just tap Cancel, and you should be able to browse normally.

[crarko adds: I tested this, and it does work as described. I've used it before with mixed success; sometimes I've had a hard time getting the Bluetooth connection between the MacBook and the iPad to stay up.]
  Post a comment  •  Comments (19)  
  • Currently 3.11 / 5
  You rated: 3 / 5 (9 votes cast)
 
[80,431 views] Email Article To a Friend View Printable Version