I recently changed jobs, and I thought it would be a time-saver in the future if i’d write down some quick instructions to setup my mac.

first step: install a decent browser

I use firefox. At the same time i installed some of my favorite plugins: Vimperator, JSONView, HTTPS Everywhere, Privacy Badger, Ghostery, Disconnect, Adblock Plus

install a decent terminal

I use iTerm2 all the time, it’s epic. Don’t forget to set the fullscreen mode to classic.

With a decent terminal in place, let’s get some of the things we need:

Install Homebrew
Run these commands to install some basic tools:
brew update
brew install ack chicken cowsay ctags ffmpeg git gpg guile newsbeuter node pandoc pass screen sl stow the_silver_searcher tig trash tree vim wget z

install dot files

Clone dot files from dotfiles repo on bitbucket and install them using stow.

install virtualbox & vagrant

Install virtualbox & vagrant

configure some stuff

  • mails
  • git
  • dropbox?

That’s about it, set up in 1 hour!

Advertisements

IMAP email debugging

November 21, 2013

Isn’t it a problem when you have to debug a problem with emails in an existing project? You never know if they are sent and to whom? I just found out that python has an awesome IMAP debugger built in! Just set your project to use these email settings:

IMAP host: localhost
IMAP port: 1025
IMAP user: {leave empty}
IMAP password: {leave empty}

Then you run this in your terminal:

python -m smtpd -n -c DebuggingServer localhost:1025

You’ll now see every mail that’s sent from your application displayed in your terminal!

That’s it… Have fun debugging

I recently discovered the awesome GNU Stow application (works on unix-like systems like GNU/Linux or Mac OSX). Stow is a symlink manager, that allows you to easily deploy and remove files to or from a directory.

Setup

Let’s say you have some configuration files in your home directory (eg: .bashrc, .vimrc and a config directory .vim) and you want to have them in git to be able to track your changes and such. It’s not a really good idea to make your whole home directory a git repo. That’s where Stow comes in. Just create a configuration directory, for instance ‘dotfiles’, and create a subdirectory for every app you have configs for. Then place the appropriate files into the right subdirectory, like this:

/home
    /{user}
        /dotfiles
            /vim
                .vimrc
                /.vim
                    ...
            /bash
                .bashrc

You can now make the dotfiles directory a git repository, and keep your dotfiles safe in git. But they’re not yet in the right place, so we’ll ask our symlink manager to fix that for us.

Create symlinks

  1. cd to the dotfiles directory
  2. You can make Stow symlink the files to your homedir like so:
    stow {package}
    where you replace {package} with the name of the subdirectory you created earlier.
  3. If you now want to remove a certain package’s config files, just do this:
    stow --delete {package}

How to install Stow

On Mac OSX

Use Homebrew:
brew install stow

On GNU/Linux

Install stow using your favorite package manager, e.g.:
apt-get install stow

That’s it!

Lately, i’ve been working a lot on my ubuntu machine at work. For several reasons, i’ve wanted to swap the ctrl and alt keys:

  1. I’m used to the OSX command key being right there where your thumb rests on the keyboard.
  2. The pinky+index finger combination of ctrl+t or ctrl+v hurted my wrist

since i’m a heavy shortcut/keyboard user, the default ubuntu setup wasn’t working very well for me.

I found the solution here. Create a file in your home dir: ~/.Xmodmap and put this in it:

clear control
clear mod1
keycode 37 = Alt_L Meta_L
keycode 64 = Control_L
add control = Control_L Control_R
add mod1 = Alt_L Meta_L

It swaps the ctrl and alt keys, and makes your wrists and thumbs happy. There’s only one downside though. The ‘switch application’ key combination of ctrl+tab now becomes a little less handy… But that can be fixed too (keyboard settings > shortcuts).

Regards
Toon

Yes, you can use Mozilla’s great e-mail client ‘Thunderbird’ with your Microsoft Exchange account! I’m doing it at work since september now, and it’s working like a charm. Sadly, it’s not very easy to get it to work. We’ll use only free (as in speech) software for this, and this will work on every major operating system (Mac OSX, GNU/Linux, Windows). Here we go!

1. What you’ll need

You can get these programs from their websites, or install them using your favorite package manager.

2. Setup DavMail

First, we’re going to set up DavMail. DavMail is a gateway for the exchange protocol. It will connect to the exchange server for us, and translate everything to standard e-mail and calendar protocols, like IMAP, LDAP, etc… You can then connect Thunderbird to Davmail, instead of connecting it directly to the Exchange server.
The installation of DavMail on every operating system is pretty straightforward, but if you can’t get it installed, there are instructions on the DavMail project site (installation on ubuntu needs a little terminal command to show the system tray icon). Once the program is installed, open the settings panel and fill in the url of your Exchange server in the “URL OWA” field.
http://mail.server.com/owa
Also make sure the ports listed under that field are not in use by other programs, and do not require root permissions. Therefore it’s best to use ports with numbers above 1000.

3. Setup Thunderbird e-mail

If DavMail is installed and set up correctly, you can now install Thunderbird, and add your Exchange account to it. Fill in your name, e-mail address, and password. Thunderbird will most likely try to find your host in it’s database and fail. You’ll have to insert your connection data manually.

First, choose the IMAP protocol. Then, you’ll have to enter hostnames and ports for IMAP and SMTP servers. Use localhost as your host, since the DavMail program is your host and listens on localhost. For the port numbers, insert the portnumbers you chose in the DavMail settings (IMAP will most likely be 2143 and SMTP 2025). As username use your full e-mail address, and as password you should use your e-mail’s password.

If that went right, you can now send and receive e-mails through Thunderbird. But that’s not all there is to Exchange, right?

More info: DavMail howto

4. Setup Thunderbird calendar (Lightning)

Install the Lightning add-on in Thunderbird. Then create a new network calendar. Select CalDav as format, and insert this in the location field (edit the port number, 2080 in my case, to match your DavMail settings, and the e-mail address to match yours):
http://localhost:2080/users/your.name@your.company.com/calendar
Choose a name and a color for the calendar in the next step. After that you’ll be prompted for your username and password. Use your full e-mail address as username and as password you should use your e-mail’s password.

More info: DavMail howto

5. Setup Thunderbird contacts

This will also be handled by DavMail. In Thunderbird, open your address book (‘Contacts’) and click File > New > LDAP Directory
Again, insert the port number you chose in the DavMail settings, and localhost as hostname. Set base context to ou=people, and as user you’ll insert your full e-mail address again. When that’s done, go to Thunderbird’s settings, and in the ‘write’ or ‘compose’ tab, tell Thunderbird to use this directory for address autocompletion.

More info: DavMail howto

That’s it! You can use Thunderbird with your Microsoft Exchange account from now. Say goodbye to Outlook and use the force with Thunderbird! There might be some small bugs here and there, but i’ve been using it for a while now, and never needed outlook for anything. Have fun!

Regards
Toon

I always wonder what would be the perfect development setup for me. Graphical? Command line? IDE? Text editor? VCS? Automation? Now it’s time to sum some things up for myself. (To make sure we speak the same language: i write php, javascript, html, css, and sh. Sometimes a little bit of python.)

I hate IDE’s. They are so bloathed with stuff you don’t need, 99% of the time. But they can be pretty useful… certainly when you have to work with big projects (or other people’s projects), it can help to have a good IDE at hand. Most of the time though, they’re in my way, they create stupid project files, they slow down my laptop and they cost money if you want a decent one. So that’s why i usually let NetBeans sleep, and wake Sublime Text or Vim instead.

Now to compensate for a few things text editors miss, compared to IDE’s. For version control i’m using Git. It’s fantastic. I use vagrant shared folders to have my code right on the development environment while developing.

For debugging, i usually use the php-cli tool in the terminal or Xdebug in the browser. To cope with a lot of ouput, i’ve colorized my prompt line, so that i can find it easily between two var_dumps.

Almost all the above relies on the power of the command line, and applies to both my Trisquel GNU/Linux and Mac OSX setups. I quite like it. On the contrary, everything above is unavailable at the place where i work. No git, no handy command line debugging (cygwin fails to install), no rsync… only a gedit install without plugins. Read more about that here.

That’s about it! 🙂
Toon

For a few years now, i’ve been amazed with how many methods there are for one to install software on his computer (GNU/Linux or Mac OSX).

  • Manual compilation
  • Download binary and put it in place manually
  • Download an installer and let it put the binary in place
  • Work with the package manager of your OS (eg: apt, pacman, yum on linux and fink, macports on OSX)
  • Work with an app store of some sort (Ubuntu Software Center, Mac App Store, …)
  • Various other methods

Let me just sum up some thoughts on every entry.

Manual compilation
This is the most difficult installation methods for non-power users, AND it’s very time-consuming. All dependencies need to be present, a compiler, and the knowledge of how to do it. If you want your software to be installed by a large mainstream population, offering only the source and compile instructions will not be enough. It is, on the other hand a convenient way to distribute software if your program is exclusively for power users, or if it needs every bit of speed and power it can use (since compiling it specifically for your system will make it run extra fast).

Download binary and put it in place manually
This was, until recently, the default installation method for every Mac OSX app. You’d download a compressed disk image (.dmg), mount it, and drag-and-drop the application inside of it to your /Applications directory. It’s quite convenient for installing software, and offers the user control over where to put his app. If this method is used for installing command line programs in /usr/bin or /bin directories, it gets a lot less convenient. You need su or sudo privileges to put it there.

Download an installer and let it put the binary in place
This is my least favorite installation method. You don’t know where the packages are going, and you mostly don’t have control over anything. It makes me think about MS Windows Install exe’s. Examples are the .pkg and .dpkg packages on Mac OSX.

Work with the package manager for your OS
This is a really convenient, and maybe the most convenient, way for users to install software. You look up the package you want to install, the package manager installs it, takes care of the dependencies, updates the software when new versions are released, and can uninstall the package when you want to. It’s mostly a little bit difficult if you want software to be installed on other locations than the defaults. Also, you’re dependent on repositories that other people made, the choose from. On most GNU/Linux systems, this is the preferred way to install software.

Work with an app store of some sort
Mac OSX and Ubuntu both offer an ‘app store’. It’s a convenient way to install and update software (but not to uninstall, on OSX…) for non-power users, and it’s really nice for developers who want to earn money with their apps. The good thing, AND the bad thing about this, is that it’s non-free. Not every application will be allowed in the store (which is, as said previously good and bad at the same time). For developers, it’s handy because the store offers a practical system to earn money for their apps, although Apple takes a percentage of each payment. To me, this is like a package manager for noobs.

Other methods
There are, of course, other methods to install software. Lately i found one i want to talk about. It’s a hybrid between ‘Manually put your binary in place’, and an ‘installer’, to which they added an update mechanism. The way they let you install there software is like this (in a terminal):

curl install.meteor.com | sh
or for wget fans:
wget -O - install.meteor.com | sh

What this does is this: curl or wget downloads a plaintext webpage, and tunnels the output to the sh program. Sh then interprets the text, which is shell a script that determines the OS, processor architecture, and checks if the meteor application (in this case) is already installed or not. After that, it downloads and installs or updates the right package for your OS and processor architecture. I was really amazed by this because it works on both Mac OSX and Linux, and for a whole lot of architectures, so it’s really cross-platform. Also, as a power user, you can first download the plaintext sh script, read it, make changes, and then run it. Nice.

Of course, there are pro’s and con’s to every item of this list, and i don’t even know which one i prefer. You can always try to persuade me in the comments below.

That’s it! 🙂
Toon