explorers' club

explorations in dev, science, sci-fi, games, and other fun stuff!

Leave a comment

Quickly Sync Mac OS’s Time via Script

I’ve noticed lately that my computer’s time is off by over a minute, sometimes several.  This happens as after I have put my computer in standby by closing the lid.  The problem it causes is that with the time out of sync, I cannot use my auth tokens to log into my work’s VPN.  So instead of opening the Time & Date preferences, I use this one line command to quickly update.

Open Terminal and type:

sudo ntpdate -u time.apple.com

You can even create an alias in your .bash_profile to make it simpler:

alias synctime="sudo ntpdate -u time.apple.com"



Leave a comment

nvm/node: an easy way to use different versions for different projects


I need to have different versions of node/npm for different projects.  I’d prefer to have each project “know” which version of node/npm it needs to use.



Before we get started, there are a few prerequisites:

  • understand that this is a Mac solution.  While I’m sure a similar solution exists for Windows, I am neither knowledgeable enough nor inclined to write a compatible shell script for Windows at this time.
  • have/install nvm.  I installed mine with Brew.
  • have at least one version of node installed via nvm
  • have a basic understanding of terminal.
  • have a willingness to edit your .bash_profile.


leveraging .nvmrc

Much like Ruby has a shortcut for setting the current version of Ruby to use, nvm has a similar feature.  When you enter the following command…

nvm use

… then nvm will look for a .nvmrc file and get the correct version number to use from there.  So first navigate to a project folder that uses node and create a new file called .nvmrc.  Inside just write 4.2.  If you’re a command-line geek then do the following:

cd <project folder>
touch .nvmrc # creates the file
echo \4.2 >> .nvmrc # appends the version to the file
cat .nvmrc # prints the file's contents

editing your .bash_profile

So the easiest way to make nvm read your .nvmrc file is to do a check when you change directories.  We need to make a function we can call when we cd into a directory:

All this is doing is

  • checking to see if the current directory matches the previous directory
  • if it doesn’t , then it stores the current directory to the previous’ variable
  • then it checks to see if a .nvmrc file exists
  • if so, then tell nvm to use it
  • lastly we tell the OS to call this command any time we do something in Terminal/Bash

Leave a comment

My Developer’s Toolbox

After a moment of pause & introspection, I realized I tend to be wordy and long-winded.  So rather than have a paragraph or 5 of WHY and HOW, I will just make a list and go from there.

IDEs, tools, things

  • WebStorm – for all things non-Adobe related, this is my JavaScript, HTML, CSS, etc. IDE of choice.
  • Flash Builder – for all things Adobe, this has been a great tool for years, built on Eclipse with plugins for SVN, Git, etc.  Love it.  I won’t be going further into anything Flex/Flash related unless requested.
  • Sublime Text 3 – shell scripting, quick looking files, XML, has a super neato feature where you can actually edit multiple lines simultaneously.
  • Git – at first I was very weirded out by Git. It had all the familiar vernacular as SVN (branch, tag, merge, commit, etc.) but the meanings were different. After taking a nose dive into it, I LOVE it.  Super easy to use, the command line is easy enough that I rarely use…
  • Source Tree – this is a Git GUI for Mac.  Somethings are better left to the command line, but for those edge cases, I like this app.
  • GitLab – not a tool per se, but an alternative to Github with private, free repos.
  • Github – free, publicly hosted Git repos.
  • Gist – this is Github’s flavor of a pastebin with the ability to fork it.  You are starting to see many stackoverflow posts utilizing this to debug/debate code
  • Mou – a markdown editor/viewer app for Mac.


  • node js – server-side js, powerfully simple with an ever-growing ecosystem.
  • npm – stands for node package manager, a command line API that comes installed with node for fetching node package resources.  Powerful stuff folks.
  • bower – a npm module that sorta does the same thing as npm, but client-side-oriented. Better-put, it’s a resource management tool.
  • require js – an asyncronous dependency loading library based on AMD.  I’m not a big fan of the AMD API as it seems verbose compared to CommonJS’s API but it’s a great utility for keeping your code modular and it’s easy to debug with.
  • browserify – a npm library that allows you to build an app much like require does, using the CommonJS’s API, but rather than loading things async, it traverses the dependency tree and compiles a single javascript file for use in the browser.  I’ve only begun to realize it’s potential as it also allows access to many node.js modules out of the box.

I’m sure I’ve missed a few.  But this is my toolbox overall.  How does your toobox compare?

Leave a comment

Bundles up your Git’s working copy changes (compared against HEAD)

Rather than give a history of why I’m doing this, I’m going to skip it and just post the code.  If there is a built in Git command that grabs the working copy (meaning non-committed changes) please let me know.  In the mean time, this will suffice.  


  1. It’s a (bash) shell script so usage would mean you open your bash shell (Terminal on Mac)
  2. navigate to the Git project
  3. type . ./create-bundle.sh

the actual script

[gist https://gist.github.com/jusopi/9258294 /]


Easy Way to Delete a Sparsebundle from Time Machine

I have had a Time Capsule in service for over 4 years.  It has been used to backup my old personal mac, my current personal mac, 2 work macs and my mom’s mac.  I’ve since updated from Snow Leopard all the way up to Mavericks, my old personal mac died (pre-solid alum body MBP 2008 era had known integrated video card issues, this one went through 2 of them), I’m no longer working for either of those companies and haven’t access to the computers and somehow my mom’s backups have been corrupted.  So…. I need to kill 4 of the 5 sparsebundle files.

This solution is going to be super quick.  You need to be comfortable with using the command line and have some patience.  When you’re deleting several dozen GBs of data, things can be slow to start.  Ok here are the steps:

  1. understand that what you’re doing is not orthodox and that it’s irreversible.  If you’re not comfortable with that idea, I’d not do this.
  2. grab a ethernet cable
  3. connect your computer to the Time Capsule (TC) with said cable
  4. make sure you can see your TC from within a Finder view in the sidebar
  5. open Terminal (either navigate to Applications -> Utilities -> Terminal or hit ⌘ + space to open Spotlight and type “terminal” and select Terminal from the list)
  6. in terminal type:
    cd /path/to/sparsebundle

    in most cases it will be located here:


    If not you can type “cd” then from within the Finder, drag the sparsebundle into the terminal where it will fetch the path for you.

  7. now the next step is where a little bit of patience is needed.  Nothing sucks more than dealing with something you’ve been banging your head against for ages only to think you have a solution and it doesn’t even provide feedback.  in terminal type:
    find ./bands -print -delete

    in some cases you may need to type:

    sudo find ./bands -print -delete

    which will prompt you for your password

  8. this is basically getting  a list of everything in the sparsebundle’s bands folder, prints it out in the terminal (which is your feedback to know SOMETHING is happening) and then it deletes them one by one
  9. you can now safely delete the sparsebundle without affecting another sparsebundle by typing:
    cd ..

    which backs us out of the current directory and then

    rm -rf ./Your.sparsebundle

This should really go without saying, but I’m not responsible for any harm that comes to your computer, data, sanity, whatever from following these steps.