Author: Jason

  • Curiosity Rover about to land on Mars

    Brendan sent a reminder that Mars Curiosity Rover is about to land. To get in the spirit you can:

  • Flipping the mouse wheel scroll direction in Windows 7

    I have been getting very confused between the mouse wheel scroll directions in Windows 7 and Mac OS X Lion. As I consider OS X to be the future, I decided to try and flip the mouse wheel scroll direction in Windows.
    Turns out there is a registry setting to do this: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\HID\????\????\Device Parameters
    Set the value of FlipFlopWheel to 1
    You need to find the USB enumeration values (shown above as ????). You can get those by going to the Mouse Control Panel, click on the hardware tab and click Properties. then in the Details tab of the HID-compliant mouse Properties window, look at the Device Instance Path property. It will be something like: HID\VID_046D&PID_C049&MI_00\7&25DD4DC&0&0000

    This is quite well documented on superuser.com and there is even a link to a little .exe that automates the whole process for you. Although I have not tried it so I can’t vouch for it.

  • Using magnets to keep dust out of the cupboard

    We recently bought an old kitchen cabinet that has a fly screen on one of the doors. I have found that it lets dust in over time, and when I go to use the glasses, they often have to be cleaned because they are dusty.

    kitchen cabinet with flyscreen in top panel of door
    Kitchen Cabinet with flyscreen in top panel of door

    I decided to make some sort of clear perspex screen to go behind the door. I noticed that iron nails were used to hold the fly screen in place and I had the idea to use magnets to hold it on.
    fly screen mesh with frame holding it into door, nail heads visible
    A bit of measuring, openscad and ebay later, I had everything I needed.
    rectangular perspex sheet with 14 6mm holes around the edge
    OpenSCAD design of the perspex sheet

    I cut the sheet out of perspex at the hacker space in Sydney. Then I glued the magnets in with super glue. That turned out a bit messy but as the magnets are not visible from the outside it doesn’t really matter.
    placing perspex sheet with magnets onto door
    perspex plate on kitchen cabinet door being held in place with magnets
    I am very happy with the result. It is invisible from the outside, and the magnets hold the perspex sheet on firmly enough that it won’t fall with the normal use of the cabinet door.

  • removing historical buffer names from the ido buffer list

    ido-mode in emacs has this great feature where it remembers old buffers you have had open in the past and offers then as choices when switching buffer using C-x b. The problem is that sometimes it will have names in the list you’d rather it didn’t remember. The solution is easy, simply hit C-k to instantly kill the entry under point.

  • gnus, imap and gnutls in win32

    I’ve been trying to get gnus working in emacs in win32 for the past few days. There were a number of obstacles to overcome:

    1. Install gnutls
    2. The gnus README.w32 says gnutls should be installed and in the path. I found that it must be in the windows system path to make it work. Setting the path within emacs was not good enough. So add C:\Program Files (x86)\gnutls\bin;C:\Program Files (x86)\gnutls\lib to your system path by going to Start/Edit System Environment Variables then click Environment Variables and edit Path in System Variables
    3. you need to edit the emacs variable gnutls-trustfiles to point to windows paths to .crt files. by default it had paths to unix locations. The only way I could find to get these files was to install cygwin and then make gnutls-trustfiles equal to ("C:/cygwin/usr/ssl/certs/ca-bundle.trust.crt" "C:/cygwin/usr/ssl/certs/ca-bundle.crt")

    Unfortunately these last two steps were not obvious to me and it took me quite some time to work through them.
    Tip: if you need to debug gnutls, try setting (setq gnutls-log-level 50).
    Now all I need to do is learn gnus!

  • Clickable links in OSX Terminal

    For some reason I never thought to search for this before. It turns out, if you CMD+double click on a web link in Terminal.app it opens the link in your browser. Very handy. CMD+Shift+double click for OSs older than Lion.

  • Converting lines of text into a numbered list in org-mode

    Recently I had a list of things in a org buffer that I wanted to turn into a numbered list but couldn’t find an elegant way to do it.
    The solution I came up with was to use a regex-replace to insert 1. in front of each line. Then I used org-mode’s C-c C-c to renumber the lines.
    I also asked on #org-mode on irc. Two interesting solutions were suggested.

    1. use string-rectangle
    2. use the string-rectangle function via the keyboard shortcuts: C-x r t 1 . <SPC>
      string-rectangle is new to me but seems as though it could be very useful. Thanks quicksilver for that suggestion.

    3. use org-mode’s org-toggle-item
    4. which is described as:
      Insert separator line in table or modify bullet status of line.
      Also turns a plain line or a region of lines into list items.
      Calls `org-table-insert-hline', `org-toggle-item', or
      `org-cycle-list-bullet', depending on context.

      The trick is to prefix it with C-u which supplies ARG to the function org-toggle-item which changes each line in a region into an item.
      C-u C-c - then S-right until you get to the list type you want.
      Thanks Thumper_ for that suggestion.

    UPDATE: zhen pointed me to rectangle-number-lines, which I did look at before but it’s default option numbers the lines without the full stop after each number. As I wanted this for org-mode, I really wanted the numbers to be formatted as “1. “. After reading the help on rectangle-number-lines though, I found that if you prefix it with the argument command C-u it will ask you for a starting number and the format of the numbers.
    ∴ Select a rectangle at least one column wide of the lines you want to number then
    C-u C-x r N <ENTER><backspace>.<spc><ENTER>

  • Delete white space around insertion point in emacs

    A while ago I discovered M-\ deletes white space between point and text.
    Now I just discovered M-spc replaces tabs and spaces around point with just 1 space.
    M-SPC runs the command just-one-space, which is an interactive
    compiled Lisp function in `simple.el'.
    It is bound to M-SPC.
    (just-one-space &optional N)
    Delete all spaces and tabs around point, leaving one space (or N spaces).
    If N is negative, delete newlines as well.

  • openscad is cool

    UPDATE: You might also be interested in my list of programmatic CAD tools.
    Brendan introduced me to openscad while we were at the hacker space last night. I really like it and I can’t believe I didn’t try this tool out before. You essentially write your solid design in a programming language. Its simple to learn and very easy to get up and running.
    There is even a scad-mode for it in emacs which I added to the marmalade repo for easy installation. Anyway here is a screenshot of a display stand I am working on.