Updates from January, 2021 Toggle Comment Threads | Keyboard Shortcuts

  • ThomasPowell 11:08 pm on January 1, 2021 Permalink | Reply
    Tags: 2009 mac, old mac, yosemite   

    Reinstalling a Clean Copy of Mac OS X Yosemite 

    Use How to get old versions of macOS to download an installer for OS X Yosemite while running on Yosemite. Run the installer and it will install the full installer to /Applications/Install OS X Yosemite.app

    Use the command line from How to create a bootable installer for macOS substitution El\ Capitan for Yosemite in the El Capitan instructions.

    Hold down option while powering on the Mac to get the option to boot from USB Recovery.

  • ThomasPowell 12:07 pm on July 22, 2020 Permalink  

    Running Linux on a Mid-2009 MacBook Pro 

    [I’ve had decent luck with the iFixIt replacement batteries (Amazon affiliate link) for extending the lifespan of 3 different Macs, Linux or not]

    Me using the same Manjaro Live USB to boot Linux on a 2012 MacBook Air

    Apple and their aggressive EOL/EOS policies

    I have had an old mid-2009 MacBook Pro (2.26Mhz, Core 2 Duo P7550) that got left behind at macOS 10.11 (El Capitan). I’ve already gone through dealing with end-of-support with a 2011 MBP (no AirPlay server, no longer getting macOS updates, etc…), but the 2009 is old enough that Homebrew itself has dropped support officially. While that doesn’t prevent everything from working, once something won’t install, you either need to fix it yourself or give up.

    I was trying to get RDP up and running when I hit that issue, so I figured that it was time to see if I could install an operating system that was still supported on the 2009 MBP.

    Ubuntu Linux attempt

    I first went down the rabbit hole of Ubuntu, but the first set of instructions I found did not give me a warm fuzzy about being able to install Ubuntu and still have a working machine. I used Rufus to write an Ubuntu ISO to a USB drive and was able to live boot into Ubuntu. Of course, Linux and wifi isn’t always plug and play and the live boot did not recognize the MBP’s wifi card, so it would have been wired or nothing until I installed the OS.

    Hello Manjaro

    Time for a different strategy. I tried a different strategy and searched for Linux distros for a 2009 MacBook Pro. I decided to go with Manjaro XFCE and was able to write the ISO to my USB drive and have wifi working on live boot, so I swapped MacBook hard drives back to the original 5400 RPM 160GB hard drive that came with it.

    Manjaro with XFCE is far snappier than even my 2011 or 2019 MBPs. This is mainly because no bloat and very little running so far, but I’ve also installed Ruby 2.8.0-dev from Manjaro in rbenv on the 2009 (P7550 Core 2 Duo) vs. from the 2019 (i7-9750H 6 core) and the install/build time was 9m31s for the 2009 vs. 11m19s for the 2019 (yes, the 11 year old Mac was faster). This is probably a Clang vs. gcc and readline + openssl installation/build difference between the two environments, but I still found it interesting that the 2009 could win the race even with a head start.

    As for system load, the MBP 2009 not actively running anything on macOS 10.11 would register a consistent 2.0+ load and would take several minutes to be usable for typing in iTerm. By contrast, running XFCE, it required several tabs open in Firefox + Terminal + gvim for the load to break 1.0.

    Steps to get up and running:

    • Download Manjaro XFCE iso
    • Write image to USB drive using Rufus (dd or whatever if you are adequately skilled at that… Rufus was just painfully easy to kick off from a Windows 10 box)
    • Hold down option while booting to get boot menu.
    • Select your USB drive
    • Boot and verify that Linux is sufficiently usable for your MacBook
    • Install to a hard drive (I recommend using a different hard drive that is booting macOS, but then you’ll need tools for the mounting screws at a minimum.
    • Boot and enjoy

    Getting set up

    Having used yum, apt, and brew, pamac was a bit of a change. For example, I had to use pamac build ruby-build and pamac build rbenv vs. an install command.

    I have starship installed as well, which was relatively straightforward, but I still need to get the fonts right for unicode.

    Overall experience

    So far I’ve been pleasantly surprised with how useful my 2009 MacBook Pro is again. I’ve managed to type up this blog post without any lag from the processor, and the memory usage is sane as well (despite Firefox). I also miss having the pre-butterfly keyboard keys to type on for writing, so it was nice to experience those again.

  • ThomasPowell 8:15 pm on April 7, 2018 Permalink
    Tags: accessibility, , hipchat, microsoft teams, tracking   

    Tracking HipChat Activity with AppleScript 

    The Problem

    Chat tools are great for being able to work remotely, at least until you get bombarded by one chat after another. I’ve often wondered if I could come up with a way to track who my chats are with and how much time was spent chatting with each person. My initial attempts involved trying to connect the HipChat API, but I would get rate-limited before I even got through the full set of contacts, much less the rooms themselves. And as far as I could tell, I had to cycle through all public and/or subscribed rooms and not just the rooms that I subscribed to.

    (You might be familiar with RescueTime doing similar for webpages, but it doesn’t appear to do that for HipChat or Microsoft Teams as far as I’ve been able to tell.)

    A Simpler Algorithm

    What if I could just log periodically when I’m chatting with a specific person or on a specific topic? I started playing with the Accessibility Inspector to try and figure out if I could get a specific path to the name display so that I could track who I was chatting with/what room I was in.

    Name in HipChat

    Name display in HipChat

    I could an incredibly long tree down to the name display, so I went directly into Script Editor with some AppleScript to dump the UI elements of HipChat (commented out below), but found that the display was too generic… so I switched to grabbing the entire contents:

    tell application "System Events"
    entire contents of process "HipChat" of application "System Events"
    UI elements of process "HipChat" of application "System Events"
    end tell

    For HipChat, the above produces a long list of element hierarchies, but static text is mentioned in the hierarchy (I used somebody else’s name because your own name appears in more windows in the view, but there may be multiple hierarchies that display the name you’re looking for):

    static text “Thomas Powell” of group 1 of group 13 of group 4 of UI element 1 of scroll area 1 of group 1 of group 1 of group 1 of group 1 of window “HipChat” of application process “HipChat” of application “System Events”,

    So I would remove the last bit of the hierarchies, and ask for the “name of” or “value of” the remainder of the hierarchy.

    name of UI element of group 2 of group 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of group 1 of group 1 of window HipChat of application process HipChat of application System Events

    Ultimately, “name of” was the key to getting the display value I was looking for, but the chat rooms had a slightly different hierarchy, and both required trial and error to find the correct hierarchy. Ultimately, the value I was looking for was in a list within the “name of” the UI element at the bottom of the hierarchy, so I continued the inspection in Script Editor until I got to the correct value.


    (Disclaimer: I am barely able to write AppleScript that parses, much less AppleScript that looks good.)

    I ended up creating an application the allows me to select a log file for output. Then I created a giant loop that checks if HipChat (or Microsoft Teams or RubyMine) or the front applications and then logs a usage with name or project in a log file + timestamp separated by a semicolon. (I used Ruby to generate the statistics based on this… sorry.)

    I don’t wait for any period if none of the applications I’m looking for are currently in front. If one of them is, I delay 15 seconds.

    set myFile to open for access (choose file name) with write permission
    tell application "System Events"
    set frontApp to name of first application process whose frontmost is true
    if (frontApp = "HipChat") then
    — set things to entire contents of group 1 of group 1 of group 1 of window 1
    — set things to UI elements of group 1 of group 1 of group 1 of window 1
    — I think this is the PM
    set myList to name of UI element of group 2 of group 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of group 1 of group 1 of window "HipChat" of application process "HipChat" of application "System Events"
    write (item 1 of myList) & ";" & ((current date)) & linefeed to myFile
    delay 15
    on error
    — Chat room?
    set myList to name of UI element of group 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of group 1 of group 1 of window "HipChat" of application process "HipChat" of application "System Events"
    write (item 2 of myList) & ";" & ((current date)) & linefeed to myFile
    delay 15
    end try
    end if
    if (frontApp = "Teams") then
    set myTitle to title of window 2 of process "Microsoft Teams" of application "System Events"
    write myTitle & ";" & (current date) & linefeed to myFile
    delay 15
    end if
    if (frontApp = "RubyMine") then
    — need to also capture the directory which is in the first element
    set staticTexts to value of static text of window 1 of process "RubyMine" of application "System Events"
    set gitMe to {}
    repeat with theText in staticTexts
    if theText begins with "Git" then
    set gitMe to theText
    end if
    end repeat
    write gitMe & ";" & (current date) & linefeed to myFile
    delay 15
    end if
    end tell
    end repeat
    on error errstr number errNum
    close myFile
    end try

    view raw


    hosted with ❤ by GitHub


    HipChat had *by far* the hardest hierarchy to find the name / chat room info in. For RubyMine, the file path and file name are in the window title and the git project are in one of the static texts near the top level. Microsoft Teams was similarly friendly in that the title of the window reflected the context it was being used in.

    Future plans:

    Hammerspoon looks a little more promising for doing anything more complex and/or DRYing this up, but there’s something to be said for being able to quickly hack your way to the data you want vs. actually having to plan things out.

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc
%d bloggers like this: