Archives For osx

Backstory

On Mac OSX, it would annoy me whenever I wanted to open a new Chrome browser on a 2nd workspace, and it would autoswitch to the first instance on the 1st workspace. We can disable it by desktop spaces auto-switching by entering a terminal command.

How to Disable Desktop Autoswitching

Open terminal and enter this command:

defaults write com.apple.dock workspaces-auto-swoosh -bool NO

Then restart the Dock by entering this command in terminal:

killall Dock

Enable Desktop Autoswitching

Open terminal and enter these two commands:

 defaults write com.apple.dock workspaces-auto-swoosh -bool YES
 killall Dock

Since ‘brew bundle’ has been deprecated, here is a temporary fix.

Create a file named brew-bundle and write the code below.

#!/usr/bin/env sh
[ -f "Brewfile" ] || (echo "No Brewfile found" 1>&2 && exit -1)
while read line
do
  [ "${line###*}" ] && brew $line
done < Brewfile

Place file in ~/bin/ and chmod +x ~/bin/brew-bundle

You’re now able to use your Brewfile again.

The ADT Bundle provides everything you need to start developing apps, including a version of the Eclipse IDE with built-in ADT (Android Developer Tools) to streamline your Android app development. If you haven’t already, go download the Android ADT Bundle.

Install the SDK and Eclipse IDE

  1. Unpack the ZIP file (named adt-bundle-.zip) and save it to an appropriate location, such as a “Development” directory in your home directory. You can also rename the folder “android” if you like.
  2. Open the adt-bundle-/eclipse/ directory and launch eclipse.

Brew Install

      Even easier is installing via brew.
      brew install android-sdk

That’s it! The IDE is already loaded with the Android Developer Tools plugin and the SDK is ready to go.

If you forget to edit a file as a superuser like sudo vim file and you don’t want to leave your existing vim session, you can use the following snippet.

:w !sudo tee % > /dev/null

Edit your ipython config file and add/edit
c.TerminalInteractiveShell.confirm_exit = False

Note: If you do not have have a config file, run ipython profile create to create one.

Remove All .pyc Files

August 16, 2013 — Leave a comment

Found a cool bash command to remove all the .pyc files from a project folder.

find . -name '*.pyc' -delete

I turned it into a bash alias in my ~/.bash_profile.

alias pyclean="find . -name '*.pyc' -delete"

The Command-T plug-in provides an extremely fast, intuitive mechanism for
opening files and buffers with a minimal number of keystrokes. It’s named
“Command-T” because it is inspired by the “Go to File” window bound to
Command-T in TextMate.

I was trying to install Command-T into VIM with the Pathogen plugin. I kept getting

checking for ruby.h... *** extconf.rb failed 
***Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

I realized my rvm environment was choosing the incorrect gcc and developer tools. I used the system ruby and was able to run everything without a hitch.

rvm use system    
cd ruby/command-t
ruby extconf.rb
make
sudo make install

Found a blog post on how to use Automater to switch ‘Search with Google’ from Safari to Chrome.

http://rentzsch.tumblr.com/post/5794765921/search-with-google-using-chrome

If you are familiar with Ubuntu, you’ll know that it has a tree command. You can install it into OSX, if you have Homebrew.

brew install tree

Afterwords, try

tree -C

I did not like how I never knew where I was in the directories of MAC OSX. You can display the full directory path by issuing this simple command from the Terminal.

defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES

Then you’ll want to restart the Finder for the command to take effect.

killall Finder

To revert back to default:

defaults write com.apple.finder _FXShowPosixPathInTitle -bool NO
killall Finder