iTerm and alt+backspace

I recently changed jobs, going from a Linux environment to macOS. When I worked in the terminal in Linux, I got used to using alt+backspace to delete entire words. Unfortunately, it seems that this function isn’t native to the Terminal application that macOS has.

However, in the application iTerm2 it’s possible to add your own key-combinations so that alt+backspace, or in this case cmd+backspace, works as it does in Linux.

Just follow these instructions:

  • Open up iTerm2 and head on over to Preferences
  • Go to Keys -> Key Mappings and press the +.
  • In the Action field, select Send Hex Code.
  • In the field Keyboard Shortcut, just press cmd+backspace.
  • In the field Hex code enter 0x1B 0x08.

And that’s it! cmd+backspace in iTerm2 should now have the same functionality as alt+backspace in Linux!

vim – Goodbye to :set paste

I’ve been using vim as my editor of choice ever since I started learning Linux, and something that has been bothering me for a while is how vim handles pasting.

Say I want to paste a large bit of code into a terminal running vim. Before I do this I have to type:

When everything is pasted, I turn it off with:


The command :set paste prevents vim from auto-indenting the code I’ve just pasted.

Luckily, as it most often goes, there is a solution. Why I haven’t bothered to actually find the answer till recently is a whole other matter.

As it turns out, my terminal of choice (which currently is rxvt-unicode) supports something called bracketed paste mode.

In short, when bracketed paste mode is set, pasted text is bracketed with control sequences so that the program can differentiate between pasted text and typed-in text.

Let’s stay that I copied the text:

from another program. When I paste it into my terminal, if it supports bracketed paste mode, it actually sends the text:

Now the thing is to let vim know how to watch out for these control sequences, and tell it what to do. Paste the following code into your .vimrc:

And that should reduce your use of :set paste quite a bit!

SimpleHTTPServer with SSL

I’ve often used Python’s SimpleHTTPServer to simply share a directory with someone over a network, it being either local or the Internet. In case you don’t know how it works, it’s simple. To start a HTTP server, at your current location, type:

and the result:

It listens on all IPv4 interfaces, and binds to the port you specify, which in my case is 8080. The person on the other side will then be able to access the files in the directory from the outside by going to, provided that your machine has the hostname, and that you have the port 8080 forwarded to the IP of server1.

But what if you want to provide a secure connection, say over SSL? SimpleHTTPServer has no built in way of doing this.

But behold ssl, Python’s built in SSL-module!

To create a secure connection for your SimpleHTTPServer, first create a self signed certificate by running the following command (if you don’t have a proper SSL-certificate, that is):

Now create a script named that contains the following code:

The only thing that needs further explanation is the variable bind_to_address. Fill this in with the text localhost if you want it to only listen to Leave it blank to have it listen to all IPv4 interfaces (

Now that the certificate and key is all in place, and the script has been created, make it executable with:

Go to the folder you’d like to share the contents of, and run the script:

The result when you visit there is no third party verification it’s listed as insecure, but it should do the trick well enough for sharing files with others.

If you however do want a free SSL certificate for a more permanent setup, I suggest LetsEncrypt! Check out for more information.

sysprep – a fatal error occurred

I’m currently testing out Windows Deployment Services, and while working with sysprep on a Windows 7 Pro client machine, I got the following error:

Nothing seemed to work, till I tried the following recipe:

Open the run-menu, type in regedit and go to HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus. Find GeneralizationState and set the value to 7.

Run a command prompt with administrative privileges. Type:

Open up regedit again and find HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform. Find SkipRearm and set the value to 1.

Finally, in your current command prompt type:

Try running sysprep again now. Hopefully it should work. That’ll save you some time of frustration and hopefully you won’t go bald sooner.

Should this not work, check the sysprep-log file at C:\Windows\System32\Sysprep\Panther\setuperr.txt.

VMware, i3 and multiple monitors

For a while now I’ve been trying to set up VMware to work with multiple monitors, in a Linux guest. With some windowmanagers it works out of the box without any issue, such as with Unity. I never figured out how to do it with xmonad, and recently I switched to i3 just to try something new. The damn “Cycle multiple monitors” button didn’t work here either. When I tried it, a message popped up saying:

The virtual machine must have up-to-date VMware Tools installed and running.

..which it had! At this point I had installed vmware-tools, which is described as:

“A suite of utilities that enhances the performance of the virtual machine’s guest operating system and improves management of the virtual machine”

However, I found a solution! Place the following line in your i3 configuration file, whether it be ~/.i3/config or ~/.config/i3/config:

..and that’s it! Reload your i3 configuration, and now you should be able to press the “Cycle multiple monitors” button and have dual monitors in your VMware guest!

Now, if you’re using open-vm-tools instead of the native vmware-tools, do what Fabian suggested – use the following line in your config-file instead:

It should work!