Faster and Resume-able Secure copy (scp)

Ever wondered how you could combine the power of rsync and simplicity of scp? Here’s how:

$ alias scpresume='rsync --compress --partial --progress --recursive --rsh=ssh'
$ scpresume -r * ssh://example.com/foodir

Simple as that!

Pulseaudio loves USB headsets

Following my habit of posting solutions to Linux problems I face (Google rocks for troubleshooting), here’s how I fixed a small issue with Pulseaudio and a USB headset I had today.

Since our team is scattered across the planet, we’re having regular VoIP/Skype calls, so we bought a couple of good headsets to use. We’re trying out Logitech Headset Clearchat Pro Usb which has a 2-year guarantee from the local computer store PLAISIO (this shop has the best support ever).

Once connected to Fedora 13 on the USB port, the headset was detected automatically by Pulseaudio. The name matched, the microphone worked, and the digital volume control buttons on the headphones worked perfectly with Pulseaudio. Sweet!

The problem was that no sound came out of the speakers. Since the microphone worked, I imagined it was a problem in the Output channel somehow. Based on this bug report I fired alsamixer, selected the USB Headset device, and found the volume level to be 0. Once the volume there was increased, oh bliss, sound came out of the headsets.

All in all, this took 10 minutes.

Logitech headset

London calling to the imitation zone. Forget it, brother, an’ go it alone
London Calling, The Clash

Setting up Network Photo Scanning

I spent around 30 minutes setting up our office printer/scanner/fax machine on Linux. While there’s been a lot of work in the CUPS world for setting up things automatically, scanning didn’t particularly work out-of-the-box.

Here’s what I remember needing to do to get scanning work on this networked all-in-one machine setup to scan.

Setup necessary packages:

sudo yum -y install xsane sane-backends sane-frontends
# Actual drivers:
sudo yum -y install libsane-hpaio
# Front-ends:
sudo yum -y install hplip-gui simple-scan xsane-gimp

Setup machine to have a static IP for future easy reference (192.168.1.50 in my case). This can be done using the machine menus. Once you know this IP, you can play around with the settings from your computer by pointing your browser to that IP address.

At this point, theoretically one can fire up hp-toolbox and add the printer & scanner from there, by adding a network printer and filling in the IP. But this tool died on me with a message “Restart CUPS”. So, here’s the workaround I did:

# Create HP URIs:
hp-makeuri -g 192.168.1.50

# Test temporarily:
xsane hpaio:/net/Officejet_6500_E709a?ip=192.168.1.50

To setup the device permanently and the SANE backend to always discover it, the following did the trick (notice the prefix hp:/):

sudo vi /etc/cups/printers.conf
[Change DeviceURI to `hp:/net/Officejet_6500_E709a?ip=192.168.1.50`]

To scan, fire up simple-scan, or xsane, or from GIMP, choose File→Create→XSane.

Finally, it’s worth noting that flegita, the GNOME scanning tool, simply crashes.

Building a new technology company is really, really hard.

In order to do it successfully, you have to sweat the details, worry about all the things that might go wrong, and suffer more than a few sleepless nights (either from working through the night or just worrying through the night).

All of those things that you go through—a boiling stomach, lack of sleep, waves of paranoia, and vivid visions of your own demise—turn out to be good things.

Creepy introduction #2

“Hi Dimitris. I was wondering whether you work on proton exchange membrane fuel cells, as I’d like to ask a few questions.”

This introduction/message came on my Facebook account. At first I thought it was a joke, but such things do exist.

Fuel cell

Rock climbing inspirations

What inspires people to go for rock climbing? Stuff like this:

Wow

(via 8a.nu)

Treating deep cuts

Tip of the day: For deep cuts, add a stronger disinfectant (hydrogen peroxide-like) on top of Betadine; better against anaerobic microbes (via @vickykorvesi).

For what it’s worth: it’s never too late to be whoever you want to be. There’s no time limit, stop whenever you want. You can change or stay the same, there are no rules to this thing. We can make the best or the worst of it.

I hope you make the best of it. And I hope you see things that startle you. I hope you feel things you never felt before. I hope you meet people with a different point of view. I hope you live a life you’re proud of. If you find that you’re not, I hope you have the strength to start all over again.

The Curious Case of Benjamin Button
Esse quam videri. To be, rather than to seem to be.
Cicero

Favorite fonts for programming

What are your favorite fonts for code editing? Mine are DejaVu Sans Mono (Vera-based) and Droid Sans Mono (Google).

Inconsolata is very good (and free) but I can’t seem to get sub-pixel anti-aliasing with it (only normal one, which at <10px gets blurry). And Envy Code R is just too condensed.

Reading this piece of code is like seeing Guernica for the first time.
moi

Typing my pass instead of root in GNOME

I’m an avid fan of using sudo when needed and avoiding typing my root password. In the command-line this works fairly easy:

su -
usermod -a -G wheel MYUSERNAME
visudo
# Uncomment the following line:
%wheel  ALL=(ALL)       ALL

In GNOME, the above won’t ‘just work’ due to the (fortunate) existence of PolicyKit. You’re always asked for your root password instead of your user password. Configuration used to involve editing PolicyKit.conf. In newer versions of Fedora, a new PolicyKit is shipped, with improved setup for policies and configurations.

After some searching around, I figured out I need to install polkit-gnome. We now have a special group called ‘desktop_admin_r’, and polkit is already setup to read from that group the desktop admins. So the new way to make GNOME ask your password instead of the root one, the following commands should just work:

sudo yum install polkit-gnome
usermod -a -G desktop_admin_r mits

For the record, gksudo is something completely different. And more evil. =/

The fastest way to succeed is to double your failure rate.
Scott McNeeley (Sun Microsystems)