Bookmarklet: Open in 1Password (iOS)

From MacStories – how you can create a bookmarklet to have a URL opened in the 1Password app from Safari.

From the article:

The URL scheme for opening website is far more useful for me. You can prepend “op” to a normal Safari URL to open it directly into 1Password. For instance, typing ophttp://google.com in Safari will launch Google in 1Password’s browser. Therefore, I made a bookmarklet that you can click in Safari to open the current website in 1Password even faster; simply create a bookmarklet with this code:

  • javascript:window.location=’op’+(window.location.href);

…And 1Password will launch the website you’re currently viewing. I tested the bookmarklet in Safari and Chrome for iOS; it has become a huge timesaver to quickly log into websites that I access on a frequent basis.

Dynamic Classpath for Batch File

From Hapi, a great way to set the classpath for a batch file:

@echo off

for %%I IN (..\lib\*.jar) DO SET CP=!CP!;%%I

java -cp %CP% com.example.Launcher

And also for shell scripts:

#! /bin/bash

CP="."
for i in ../lib/*.jar;
do
		  CP=$i:$CP;
done

java -cp $CP com.example.Launcher

Turning off SafeSleep

Quoting completely from Remiel

Ever since the PowerBook G4, Apple notebooks use a system called Safe Sleep to restore your computer to working order after being left unattended for a while. With Safe Sleep, the current session is written to both RAM and your hard disk — RAM because waking up is faster that way, and the hard disk so that the system can safely go into hibernation if the battery drains while it’s asleep.

Your computer will go into standby faster if you turn this off. You can also save some space on your hard drive by disabling Safe Sleep, and removing the sleep image. You’ll still be able to sleep your computer, but there’s no zero-battery safety net anymore. Your MacBook can go a very long time in RAM-only sleep mode on a full battery, so this should rarely affect your life. But keep in mind that if the battery does run out, you’ll lose any unsaved work.

This Macworld article goes into greater detail about Safe Sleep, but for our purposes, the short version is this:

  1. Open up Terminal.
  2. Type “sudo pmset -a hibernatemode 0” without the quotes, and hit Enter.
  3. Enter your password when prompted.
  4. You are now using RAM-only / “old school” sleep mode.
  5. Now type “cd /var/vm” and hit Enter.
  6. Finally: “sudo rm sleepimage”
  7. This will delete the existing sleep image file on your hard drive, reclaiming that space for future use.

Aqua Data Studio 6.5 with Java 1.6

I use an older version (6.5) of Aqua Data Studio (an excellent tool), but it recently broke on the Mac when Java 1.6 came out. There is a quick fix for this, as the problem was a few classes moving outside of the JRE’s default libs.

Download this file and put it in AquaDataStudio.app/Content/Resources/Java.

Someone else came up with this solution, but I have no idea of the original source.