• BMW option codes list

    If you ever need to know what the option codes on your BMW represent you could use this German page (English translation) containing an extensive list of them.

    There is also another list already in English which unfortunately is a bit old but probably still valid for many of the existing BMW Option Codes in use today.

  • Vim: paste indent problems

    On one of my boxes I came across this weird behaviour when pasting code into Vim at the terminal. All indentation was broken in a stepped way. Every line indented more and more creating a real mess to work with. This only happened when actually pasting content into the terminal. Typing worked as normal.

    I initially thought that it had something to do with Putty‘s way of interacting with this specific box e.g. some configuration that was missing. Issues exist with carriage return (CR) and line feed (LF) handling across platforms. Nevertheless this was a dead end.

    Digging around Vim’s extensive wiki provided some clues as to what was going on. Having ‘autoindent‘ or ‘smartindent‘ on creates havoc when pasting into Vim and therefore should be disabled. The problem is that these are nice features to have on when simply typing.

    Vim has an alternative mode called ‘paste‘ that does not modify the pasted input in any way and therefore code looks just as in the original source. To enable ‘paste‘ mode during insert simply type ‘:set paste‘ and you are ready to paste. When finished pasting you probably want to leave ‘paste‘ mode by typing ‘:set nopaste‘.

    As I am too lazy to type this every time I need to paste something I have now added the ‘pastetoggle‘ key into my profile’s .vimrc file as follows: ‘set pastetoggle=<F12>

    From now on simply hit F12 on the keyboard and you will be in ‘paste‘ mode. Press F12 again to leave it.

  • Wget, HTTPS & ignoring robots.txt

    Wget has many usages as you probably are aware of. One of them being an easy method of mirroring parts of or even entire sites.

    Lately I am working on a project which required an exact copy including all dependent media files to be mirrored from another site. Working server side it is much easier to simply retrieve the files via Wget directly to the server instead of downloading them to the local machine and from there upload them to the server in question. Wget simply saves me from doing all this extra work.

    The Man page of Wget is extensive and includes all kind of options to quickly get around the most quirky tasks.

    Specifically with this task I experienced trouble. I did not get all files requested and different combinations of options and parameters did not accomplish what I was after. Several failed attempts made me even consider copying the files over one by one manually…!

    As the pages in question were served as HTTPS I started suspecting Wget having issues with secure connections. After enabling the debug switch (‘-d‘) as suggested I realised that Wget was actually encountering a robots.txt file that excluded all the directories and files I was trying to retrieve. Wget follows the Robot Exclusion Standard but it can easily be circumvented by using the ‘-e‘ switch:

    wget -e robots=off url
    

    If you wish to turn off the robot exclusion permanently, set the robots variable to ‘off‘ in your profile’s ‘.wgetrc‘ file.