Linux

Adding ‘addremove’ to Git

Friday, April 9th, 2010 | Linux, Programming, Software | No comments

I’m a happy git user, but mercurial has a nifty command with no git equivalent: hg addremove. This command removes deleted files from the repository and also adds new files in the current directory. For me, at least, it’s a useful command that I’d like to have. Of course, git is nothing if not flexible, so let’s add this command! I’m using a suggestion for a script that I found here. Add the following lines to your $HOME/.gitconfig:

[alias]
    addremove = !git add . && git ls-files --deleted | xargs --no-run-if-empty git rm

Tada—git addremove puts new files in the staging area and also removes deleted files. Now you don’t have to pay attention to your hipster friends who try to tell you how great mercurial is.

Tags: , , ,

Using notify-send to Slack Off Efficiently

Thursday, December 17th, 2009 | Linux, Programming | No comments

I’ve been working on a big project in MPI and the execution times on my code are annoyingly long (on the order of minutes). I like to keep my work in a separate workspace from my browser to minimize distractions, but then when I set my code running and head over to visit reddit or something I often don’t notice when my code finishes. Today it occurred to me that this would be a good use for libnotify. There is a command-line utility called notify-send (you should have it if you have a recent version of Ubuntu; not sure about other distros) which gives a simple interface to libnotify, so I whipped up a tiny script to call it:

#!/bin/bash
 
EVAL_STRING="notify-send -u normal -t 5000 -i info \"Task completed\" \"$@\""
eval $@; eval $EVAL_STRING

I put it in a folder which is in my path, and now I just do

$ notify ./takes_forever

and I know as soon as it’s done. OK, back to work.

Tags: , ,

Keyboard Remapping in Windows XP

Tuesday, June 2nd, 2009 | Linux, Software, Windows | No comments

When I found that I had to use Windows for work, the first thing I did was to install gvim and my usual host of plugins. The next thing was to remap caps lock and escape. I switch these when I’m using Linux because I don’t really ever use caps lock, but I use escape all the time (especially in vim). In Linux it’s a simple .Xmodmap entry:

› Continue reading

Interfacing C and Python 3 using SWIG

Monday, April 27th, 2009 | Blog, Linux, Programming, Software, Technology | 1 comment

I like Python, and I use it for almost all of my personal projects and whenever I can get away with it in school. Sometimes, however, (rarely, these days) you’re looking for raw speed. Python, alas, is not the fastest kid on the block, and at these times you might have to turn to a different language to give you the necessary speed. (Another option you might consider first is Psyco.) In these situations it is often the case that only particular operations or functions really have to be fast. Even if you want to write the whole piece of software in C, you might like to use Python to write the front end. There are a lot of different ways to do this, but my favorite is SWIG, because it’s easy and I’m lazy.

› Continue reading

Tags: , , ,

64-bit Flash Player!

Sunday, November 16th, 2008 | Blog, Linux, Software, Technology | 1 comment

Today Adobe is releasing an alpha version of a 64-bit Flash player for Linux. I cannot explain how happy this makes me. I have been dealing with shitty 32-bit Flash players running on 32-bit emulation in 64-bit browsers in Linux for about the past five years, and it has caused me nothing but endless annoyance and frustration. Half the time I have to refresh a page a few times because Flash keeps dying, and even when it manages to play it’s a complete coin toss as to whether there will be sound. With my current setup I basically have to close Amarok to play a Flash video if I want to hear sound. Adobe is years late to the party with this one, but better late than never, right?

Howto: Dual Monitors with Ubuntu and NVidia

Monday, September 29th, 2008 | Blog, Linux | 2 comments

Pursuant to my previous post on using dual monitors in Linux, I decided to post a some information that would have definitely appreciated having a long time ago. This specifically covers how get two monitors working in a reasonable fashion in Ubuntu and Xubuntu, but I originally figured it out in Gentoo (and it applies to other distros).

› Continue reading

Dear Xinerama: Goodbye, and Good Riddance

Wednesday, August 6th, 2008 | Blog, Linux | No comments

Having used many distros of Linux with a variety of graphics cards during the past five or so years, I’ve had plenty of opportunities to get my hands dirty with xorg.conf. When I eventually got an Nvidia card and discovered nvidia-settings, it was great to not have to mess with xorg.conf any more…or not. I still had to read up on xorg.conf options whenever I wanted to do something fancy, but I found nvidia-settings to be a useful tool for generating xorg.confs that I could later modify.

A few years ago I started using two monitors with my desktop computer. In nvidia-settings I had two options for configuring the monitors: either with TwinView or Separate X servers. Separate X servers is hugely annoying, so that was out. TwinView made my window manager (Fluxbox, at the time) think that I basically had one screen. This meant that maximizing applications caused them to fill both screens. It also meant that no edge snapping occurred at the border between the monitors. I have seen experienced the same behavior with TwinView in Xfce. This means that for at least two years I’ve associated TwinView with pure suck.

› Continue reading