Updates from September, 2020 Toggle Comment Threads | Keyboard Shortcuts

  • ThomasPowell 10:31 am on September 1, 2020 Permalink  

    Regex testing in test in zsh and launching a browser page 

    I get so many casual mentions of ticket numbers in our discussions and I keep hacking old URLs for tickets to look them up, or clicking through JIRA boards and views to navigate to the proper ticket, only to have them pull up in a sidebar in JIRA requiring more clicks to get to a useful view.

    So, I wrote a quick script in JIRA called gojira to launch a browser window (macOS from the terminal):

    open https://jira.example.com/browse/$1

    With the above script, I can just invoke gojira PROJECT-1234 to bring up the ticket.

    Ok, so that’s great but 90% of the ticket numbers are referencing the same project. So what if I want to only specify a ticket number some times? That’s when I finally looked up if you can test (alias [ ]) a regex in zsh. Turns out that you can.

    If regex

    The fairly common =~ operator is available for test/[] in zsh. You do have to double the square brackets for it to work (and single quote your regex):

    if [[ "$1" =~ '[[:alpha:]]+-[[:digit:]]+' ]]
      open https://jira.sdlc.appriss.com/browse/$1
      # default to PROJECT if only a number is specified.
      open https://jira.sdlc.appriss.com/browse/PROJECT-$1

    Why not a function?

    Of course, this can also be handled in a zsh function and added to your .zshrc or .zlogin:

    function jira() {
      if [[ "$1" =~ [[:alpha:]] ]]
        open https://jira.sdlc.appriss.com/browse/$1
        open https://jira.sdlc.appriss.com/browse/PROJECT-$1
  • 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.

  • tech0x20 9:43 am on April 15, 2009 Permalink | Reply
    Tags: , rush,   

    rush: the ruby shell 


    rush is a replacement for the unix shell (bash, zsh, etc) which uses pure Ruby syntax. Grep through files, find and kill processes, copy files – everything you do in the shell, now in Ruby.

    Install rush

    If you’re running windows and have Ruby installed, go to Start->Ruby-{version}->RubyGems->RubyGems Package manager and type in “gem install rush” at the cmd prompt.

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: