Friday, January 20, 2012

iCal alarms for recurring subscribed events

iCal won't alarm on events in subscribed to calendars, such as Facebook.  I guess the originator of the event has to set whether to alarm or not.  So I spent a little time leaning AppleScript, and here's a script that does it.
on run the_calendars
    try
        length of calendars
    on error
        set the_calendars to {"Facebook"}
    end try
    
    set today to (current date)
    set this_day to day of today
    set this_month to month of today
    set to_display to ""
    
    tell application "iCal"
        repeat with the_calendar in the_calendars
            tell calendar the_calendar
                repeat with the_event in every event
                    set the_date to start date of the_event
                    set the_day to day of the_date
                    set the_month to month of the_date
                    
                    if (the_month = this_month and the_day = this_day) then
                        set to_display to (to_display & summary of the_event as string) & return
                    end if
                end repeat
            end tell
        end repeat
    end tell
    
    if (length of to_display > 0) then
        display dialog to_display
    end if
end run

Open up you AppleScript Editor, copy and paste, and save somewhere. Now, you'll need to have it run every day. So I learned a little about launchctl. Save the following script to ~/Library/LaunchAgents. I called mine 'edu.ucar.icalsubscriptions.plist'. You'll need to modify the Program path to where you saved your script, and possibly the time it runs if you don't like 0900. You might also need to change the name of the calendar to match the name of the calendar in iCal -- mine is called Facebook -- and you can have a list of them if you want.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC
     "-//Apple//DTD PLIST 1.0//EN"
     "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>Label</key>
            <string>edu.ucar.icalsubscriptions</string>

        <key>Program</key>
            <string>/Users/beaty-admin/iCalRecurring.app/Contents/MacOS/applet</string>
            

        <key>ProgramArguments</key>
            <array>
                <string>Facebook</string>
            </array>

        <key>StartCalendarInterval</key>
            <dict>
                <key>Hour</key>
                    <integer>9</integer>
                <key>Minute</key>
                    <integer>0</integer>
            </dict>

        <key>Debug</key>
            <true/>
    </dict>
</plist>

Wednesday, January 18, 2012

Passwords

People ask me about security, and much of it is based on having good passwords.  In general, one-time passwords are best.  These change each time one logs in; yubikeys and RSA ids are examples.  Two factor -- typically one reusable and one ephemeral (e.g.: SMS text your cell phone) -- are good too.  When we're stuck with reusable (using the same one again and again), then picking good ones is critical.  Good ones are both long and difficult to guess.  Random is best, as we humans aren't as random as we first appear.  As long and random passwords aren't memorable, we need password keepers.  Firefox will remember passwords for you; I recommend you allow it to do this, but: set a master password!  I also recommend using keypass from http://keepass.info/ for whichever platform you have.

So, let's do a little math.  26 lower case letters, 26 upper case, 10 digits, and 10 symbols equals 72 characters.  Let's say you have 8 character random passwords using each of the character classes and no repeated characters.  So, 72*71*70*69*68*67*66*65 -= 482,590,739,030,400 possible passwords.  Not bad.  Now let's go to 20.  72*71*70*69*68*67*66*65*64*63*62*61*60*59*58*57*56*55*54*53 = 759,184,772,617,383,139,127,116,820,643,840,000 possible passwords.  Good enough for the time being.

All that said, how do you get random passwords?  There a twenty-letter one at the bottom of this page.  It was generated using simple JavaScript -- here's the code:
<script type="text/javascript">
var letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"

for (var i=0; i < 20; i++)
{
    document.write (letters.charAt (Math.floor (Math.random() * letters.length)));
}

</script>

This assures the password is generate on you machine, in your browser.  You can cut and paste it into a password field, and into keypass.  Don't use sites that generate passwords on the server itself -- they're trying to social engineer you.  And remember: you don't have to remember it, have your computer do that for you.

Random Password:

Thursday, December 1, 2011

Cleaning espresso machines

I'm called on to clean espresso and coffee machines from time to time. I like Cleancaf:

Mix it, pour it in, and interrupt the brewing cycle. Let it sit a in the machine for a few hours. Here's a glass full of murky water that came out of the steam wand of a machine that had been ignored for five or so years

Friday, November 11, 2011

8-port serial board under Linux

I work with a machine that has an 8-port serial board in it.  For Linux to see all the ports, I had to do two things.
  1. Add '8250.nr_uarts=12' to the kernal boot line in /boot/grub/menu.lst
  2. Turn off ACPI.  That entailed '/sbin/chkconfig acpid off; reboot'
The result of an /sbin/lspci showing the specific board:

07:04.0 Serial controller: Oxford Semiconductor Ltd OX16PCI954 (Quad 16950 UART) function 0 (Uart)
07:04.1 Bridge: Oxford Semiconductor Ltd OX16PCI954 (Quad 16950 UART) function 1 (8bit bus)
07:08.0 Serial controller: Oxford Semiconductor Ltd OX16PCI954 (Quad 16950 UART) function 0 (Uart)
07:08.1 Bridge: Oxford Semiconductor Ltd OX16PCI954 (Quad 16950 UART) function 1 (8bit bus)

Monday, October 10, 2011

Excluding files or directories from Time Machine

There are a number of places that talk around excluding files or directories from Time Machine backups, but I thought I'd share the most direct way.  The global exclude list can be opened using
$ open /Library/Preferences/com.apple.TimeMachine.plist
but if you want finer-grained control, you can use extended attributes.  The following commands exclude several directories where I have experimental VirtualBox VM's that I don't need backed up:
$ xattr -w com_apple_backup_excludeItem com.apple.backupd VirtualBox\ VMs/Windows\ 7/
$ xattr -w com_apple_backup_excludeItem com.apple.backupd VirtualBox\ VMs/OpenBSD/
To remove an extended attribute, use xattr thus:
$ xattr -d com_apple_backup_excludeItem VirtualBox\ VMs/
To see which extended attributes are set on a file or directory, use the '@' argument to ls:
ls -l@ VirtualBox\ VMs/
total 0
drwxr-xr-x@ 6 beaty-admin  staff  204 Jun  1 13:53 OpenBSD/
    com_apple_backup_excludeItem     17 
drwxr-xr-x  6 beaty-admin  staff  204 Oct  5 15:46 Ubuntu/
drwxr-xr-x@ 7 beaty-admin  staff  238 Oct  6 21:22 Windows 7/
    com_apple_backup_excludeItem     17 
drwxr-xr-x@ 6 beaty-admin  staff  204 Sep 29 21:38 XP/
    com_apple_backup_excludeItem     17 
And: Let Time Machine backup File Vault while logged in

Wednesday, September 14, 2011

Turning off the blinking cursor in gnome-terminal

It shouldn't be this difficult, but one has to run 'gconf-editor', search to '/apps/gnome-terminal', and double click on cursor-blink-mode, and change the value to 'off':

Monday, July 25, 2011

Pretty on the outside

I have one of those nice Rosendahl II watches from http://www.thinkgeek.com/gadgets/watches/7a91/  Other people have noted how one has to be very careful fitting the band to your wrist as it is a destructive procedure.  Well, changing the battery isn't easy either, and if you're not careful, also a destructive procedure. After taking the back off, one needs to remove the plastic battery holder, essentially the whole gray thing you see after taking the back off.  It is connected in two places (see the red arrows) and one cannot take the battery out without removing it.

Giving one this

Once that is done, one can gently pry off the clip holding the battery.


Assembly, as they say, is the reverse.