dpc's blog

Unix Geek ideas on the go.

Handy `retry.sh` Script.

| Comments

It’s often the case when I have a command that has a high chance of failing and I want to retry until it’s successful.

Because of this I’ve created a retry.sh script like this:

1
2
3
#!/bin/sh

while ! "$@"; do sleep 1; done

Very simple, and does the job well.

Eclipse as an Excellent GDB Frontend.

| Comments

The idea for this post started after I’ve read Jonathan Blow: Cost of Switching to Linux is Too High for a Game Developer article.

Jonathan Blow states:

The main reason is that debugging is terrible on Linux.

and i find this ridiculous for many reasons. Other claims in this article are ridiculous as well, but to the point.

I’m amazed how few people know how easy is to use Eclipse as a frontend to GNU Debugger and how well it works. The only reason I personally don’t use Eclipse + GDB combo is because I’m a hardcore commandline guy and I spend my days in ZSH, Vim and plain GDB. And I have a handy script for literally everything that is repetitive.

So I’ve decided to write a simple guide on how to get started plus add some nice screenshots as a teaser.

My New Rig.

| Comments

Some while ago my workstation just stopped booting. Too bad. After a long investigation it seems that mother board has died. As it was two years old already and I needed a decent computing power to work on I’ve quickly decided to build a new one. And this post is about my new computer.

I think it’s pretty nice so I want to share it: maybe some people searching google will land here to read what I think about specific parts that I’ve used. Plus, I’ve promised to describe my impressions to the people that have helped me design it.

Feel free to contact me, if you have any questions. Especially if you’re a Linux user.

Lots of RAM? Precache All the Things!

| Comments

Having a lot of RAM nowadays is relatively cheap and Linux can make a good use of it. With tools like preload most of Linux distributions are trying to proactively read things that you might want to use soon.

However if your desktop have a ridiculous amount of memory (mine has 32GB) it may take ages for these tools to make fill your memory. And why would you pay for it and then let it just sit idle instead of working for you?

The thing is: you can do much better, because you know what you are going to use in the future.

So, as always, let’s write a tiny script under the name precache.

1
2
3
4
#!/bin/sh

exec nice -n 20 ionice -c 3 find "${1:-.}" -xdev -type f \
  -exec nice -n 20 ionice -c 3 cat '{}' \; > /dev/null

Personally I keep it as $HOME/bin/precache.

Facebook Automated Wall Cleaner.

| Comments

Recently Facebook behavior started getting on my nerves:

  • applications are doing things I haven’t allow them to do
  • I’ve noticed that Facebook collected some data I don’t remember giving to it (My credit card number?! How the hell… ???)

That’s why I’ve decided to erase my Facebook profile, remove all Facebook related applications from my phone and other places that I’ve used. It’s hard to completely delete and stop using Facebook account and I’m sure they are keeping all the deleted data anyway, but it’s still better than nothing. From now on, I plan not to give Facebook anything that I wouldn’t show publicly.

To the point. Most things can in Facebook profile can be removed manually pretty easily. The only part that was hard was removing five or more years of my wall posting activity.

I’ve decided to automate this and that’s why I’ve written a iMacros for Firefox script to do it.

DLNA Streaming in Ubuntu 12.10

| Comments

I recently got tired of a cable laying across my room from my PC to my stereo system.

I was aware of DLNA and most popular Linux daemons suite implementing it: Rygel.

I decided to try DLNA output streaming from my desktop PC (with Ubuntu 12.10 installed) to Galaxy Nexus phone.

Getting this working was quite difficult, but I think I got nice results so I want to share it. I use lossless FLAC streaming and I get delays around 3 seconds, which seems to be quite good, comparing to what other people on the web were able to achieve.

Asynchronous GNU Readline Printing

| Comments

Some while ago I’ve spend my time developing a XMPP command line client which is using strophe XMPP library to handle XMPP and GNU Readline for I/O.

The idea was to have a readline prompt at the bottom and yet be able to asynchronously print incoming messages above it – in the “log window”.

It seems that many people were looking for solution already:

I haven’t found any satisfying answer on the web so I’d like to present my own solution.

Teach Your Shell How to Grab Your Attention

| Comments

In my daily work it’s often a case when I have long-running process that I have to wait for to complete and I don’t want to stare at the shell all the time.

Some terminal emulators do have features like “Monitor for Silence/Activity”, but gnome-terminal does not. That’s why I decided to build something more shell-based and generic.