Archive for January, 2012

Test if a webpage exists

January 24, 2012 Leave a comment
curl --head
# or, the same:
curl -I

Sample output:

HTTP/1.1 301 Moved Permanently
Content-Type: text/html; charset=UTF-8
Date: Tue, 24 Jan 2012 20:22:14 GMT
Expires: Thu, 23 Feb 2012 20:22:14 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 219
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN

For a pure Python solution, check out this post.

This tip is from here.

Categories: bash, python Tags: ,

Tesseract OCR

January 23, 2012 Leave a comment

The Tesseract OCR engine was one of the top 3 engines in the 1995 UNLV Accuracy test. Between 1995 and 2006 it had little work done on it, but it is probably one of the most accurate open source OCR engines available. The source code will read a binary, grey or color image and output text. Image input is managed by the Leptonica Image Processing Library which can read a wide variety of image formats.” (source)

As so many times, the Ubuntu repos are out-of-date again :( Via apt-get you can install version 2.

Version 3 is also available and works much better than v2. Installation notes are here: notes #1, notes #2.

The two versions can co-exist. V2 is installed to /usr/bin/tesseract while v3 is installed to /usr/local/bin/tesseract.

There is a Python library for Tesseract called pytesser.

I’ve integrated pytesser in my jabbapylib library, supporting Tesseract v2 and v3 too.

Update (20120505)
Installing tesseract v3 from source is now integrated in jabbatron.

Categories: python, ubuntu Tags: , ,

Full Circle Magazine for Kindle

January 21, 2012 Leave a comment

“EPUB and MOBI editions of FCM #56 are now online!
(back issues are being worked on)

Click the link beside the cover.”

I suggest using Calibre with your e-book reader. You can install it via apt-get.

Difference between SIGTERM and SIGKILL

January 10, 2012 Leave a comment

Major Hayden has a nice post on SIGTERM and SIGKILL.

Here I sum it up. When you execute “kill 123“, it sends a SIGTERM signal to process 123. In this case the process has a chance to clean up (e.g. free resources) before exiting. The brutal “kill -9 123” sends a SIGKILL signal and terminates the process immediately, i.e. no time for cleaning up. Be nice and first try SIGTERM.

In Python, you can kill a process the following way:

import os
import signal

os.kill(pid, signal.SIGTERM)

Geek rap “kill -9”

At the Racker Hacker blog you can find several posts related to server administration.

Categories: bash, python Tags: , ,

Storing sensitive data in your Dropbox folder

January 7, 2012 1 comment

You want to store some sensitive data in your Dropbox folder, e.g. passwords. How to protect these data?

In your Dropbox folder create a Truecrypt volume and store your data in this encrypted virtual file system. For more info refer to this article.

I wanted to store some credentials that I wanted to access from several machines. In my Dropbox folder I created a 10 MB Truecrypt volume. I mounted it and put the sensitive data in it.

Categories: security Tags: ,

Playing Star Trek background noise with a Linux command

January 6, 2012 Leave a comment
play -n -c1 synth whitenoise lowpass -1 120 lowpass -1 120 lowpass -1 120 gain +14

Even better if you add this to your .bashrc file:

alias engage="play -n -c1 synth whitenoise lowpass -1 120 lowpass -1 120 lowpass -1 120 gain +14"

Multiple versions:

# Engage Warp Drive

# Requires package 'sox'

# odokemono
# original
# play -n -c1 synth whitenoise band -n 100 20 band -n 50 20 gain +25  fade h 1 864000 1

# noname-_-
# stereo
# play -c2 -n synth whitenoise band -n 100 24 band -n 300 100 gain +20

# braclayrab
# play -n -c1 synth whitenoise band 100 20 compand .3,.8 -1,-10 gain +20
play -n -c1 synth whitenoise lowpass -1 120 lowpass -1 120 lowpass -1 120 gain +14

(via reddit and hup)

Categories: bash, fun Tags: ,


January 6, 2012 Leave a comment

Categories: fun Tags: ,

64-bit Ubuntu runs fine

January 6, 2012 Leave a comment

I’ve been using 32-bit Ubuntus for years. I was always afraid of the 64-bit versions, I thought they were not yet ready. A few months ago I read that from 12.04 Canonical will recommend the 64-bit version by default. A few weeks ago I bought a new desktop machine with more than 4 GB RAM and I decided to install the 64-bit Ubuntu 11.10. I can say it works perfectly for me. I don’t have any problems with it. Flash videos work well too. So from now I also recommend the 64-bit version :)

Categories: ubuntu Tags:

Tweak your Ubuntu

January 3, 2012 Leave a comment

Ubuntu Tweak is an application to config Ubuntu easier for everyone. It provides many useful desktop and system options that the default desktop environment doesn’t provide.

UT is provided in .deb format, so its installation is trivial. You can start it with “ubuntu-tweak“.

I find the following options particularly useful:

  • Under Tweaks -> Miscellaneous, you can put back the icons to menus and buttons.
  • Under Tweaks -> Compiz Settings, you can assign window operations to workspace edges.
Categories: ubuntu Tags: , ,

Java plugin for Firefox under 64-bit Ubuntu 11.10

January 3, 2012 Leave a comment

This entry is based on this post.

I have a 64-bit Ubuntu (11.10) and I want Java support in Firefox.

My Java SE 7 update 2 is installed to /opt/java.

cd /usr/lib/mozilla/plugins  
sudo ln -s /opt/java/jre/lib/amd64/  

Well, this isn’t working perfectly for me. In Firefox it appears under the Plugins tab and according to Java Tester it’s OK. However, if I visit, Firefox freezes :(

Categories: firefox, ubuntu Tags: , ,