Which Java process runs which application?

If you’re running more than one Java application the ps commandis not enough. It will list the Java processes, but not which Java process runs which Java application. The jps comes with the JDK and is your friend!

Found on StackOverflow in a post by user Nicolas Shushkin.

Use serial port as regular user in Ubuntu

By default a regular user does not have permission to use the serial port. In my case I wanted to use two USB-to-serial adapters:

By looking at output you can see that the owning group is dialout. So it is a matter of adding your user to that group (and logout/login as with every user rights change). The bash environment variable $USER contains your username.

Found on the Ubuntu help pages.

.gitignore keeps your repository sane – some helpful resources

Ignoring files is a great article on GitHub Help. The global gitignore file is mentioned there. In this file you can ignore files in all the git repositories on your machine. There is a very helpful template that will ignore compiled output files from various languages (*.o, *.so, *.dll, *.class) as well as logs, database files, packages and also files generated by the operating system (Yes, I’m looking at you Windows Thumbs.db and Mac .DS_Store!).

The above page also links to the gitignore repository on github. This repo contains a whole bunch of gitignore files for programming languages, build systems, servers, markup languages, content management systems, … There is also a global folder for more your global ignore file (IDEs, text editors, non-git version control, operating systems…).

Reference or use git/github-managed code in your git project

Please note that there seems to be better way to do this since git version 1.8.2 (mentioned in these two stackoverflow answers: here and here). The version from the Ubuntu 12.04 repos is 1.7.9.5 though so I’ll take a different route. The project for this example is the handy node.js multi-platform support layer libuv.

Please note that this example expects you to already have an existing project under git control. If you don’t – simply look up on how to create one using git init or git clone one 🙂


# do a "clean cut" before adding the submodule
git commit

# add libuv to the project
git submodule add https://github.com/joyent/libuv.git libuv
git status

# update the submodule
git submodule init
git submodule update

# enforce the version we want to use (tag v0.10.22)
cd libuv/
git reset --hard v0.10.22
cd ..
git commit -a

git submodule status

You can now reference/include the files of the submodule while still being able to update the submodule to newer versions. Gotta love version control!

UPDATE: One function to extract them all!

UPDATE: There is a Python script that has some extra features (like extraction into a dedicated directory and changing of permissions).

I seriously fail to remember all those tar options for each of the supported archives 🙂 So I’m happy to have found a bash function that will simply chose the right command based on the file extension:

Simply put the function at the bottom of your .bashrc file. Either close and re-open the terminal you’re using or type source ~/.bashrc to refresh the changes of your bash environment.

Now you can just type extract your_archive_here.xyz and the function will extract the archive and cd into it. Super time-and-brain-energy-saver! 😛 I found this function on the Ubuntu forums in a post by user graysky.