Desktop Goodies

October 21st, 2012 subogero No comments

g

is the new go. The name of my Gnome command-line launcher clashed with a certain programming language, so I changed it. Not the programming language stupid. Mostly out of respect for probably the greatest hacker of all time who is involved in the go language. His other inventions include Unix, regular expressions, utf8 encoding and brute force. Finding out his name is left as an exercise to the reader.

tapeta

Hungarian for wallpaper. I was looking for a desktop wallpaper slide show program for Linux. The best the internet could come up with was Desktop Drapes. It has a few small problems, though. You have to add every single picture manually to the list of wallpapers. Oh, and it does not work as a Startup Application. While trying to find out why, it turned out it uses mono (.NET for Linux). So everything is forgiven. I’m sure it’s the wallpaper changer of choice of Miguel de Icaza.

On the other hand, I’m a picky little bastard. I just want to pile the wallpapers-to-be into a folder, specify a cycle time, and go. And I want it to work. And I want it to be small. So I wrote one. Apart from comments and the help text, it’s a 12 line shell script. It supports Gnome2 and MATE at the moment.

Default cycle time is 10 min and the default folder is ~/Pictures. It can be changed in the ~/.tapeta configuration file.

notgmail

Or rather yes. I mean it’s all about Gmail new email desktop notifications for Gnome2 and MATE. Mostly for mutt users. It looks for your Gmail login in .netrc and .muttrc. It’s a staggeringly large 18 line net shell script. The semi-transparent black notification-box lists the senders of your unread mails. The default polling time is 30min, can be changed on the command line in [s].

And it does use DOM to parse the Gmail Atom feed. Not.

Categories: Uncategorized Tags:

Inferiority Complex Considered Harmful

September 12th, 2012 subogero No comments

Recently, I’ve upgraded the HP 874W power station to Linux Mint Maya, 64-bit, MATE edition.

It’s pretty stable, the performance is brutal, and it has very new packages out of the box, like VIM 7.3 (I’m looking at you Debian Squeeze). But the Gnome2-MATE conversion is still a work in progress. A few things are still broken, like the power button brings up the shut-down dialogue for exactly zero seconds and, unfortunately, Compiz does not work out of the box.

It took me two evenings to play with the Configuration Editor (gconf-editor), the Configuration Editor (mateconf-editor) and CCSM to reach a state, where Compiz places, decorates, wobbles and peeps through windows in the desired fashion, and the virtual desktops are spinning and exposing as in the old times. Except, there is no way to start the old hierarchical menu with Alt-F1. So I’m forced to use the chaotic MintMenu. By now my readers have figured out, correctly, that I’m a keyboard-guy.

So Ubuntu Lucid Lynx will stay on the ultra-portable ASUS UL20A for at least another year. This OS is the symbol of the golden era of the Linux desktop, 2010. Dark clouds were already gathering on the horizon, but here, down on Earth, everything looked rosy and happy. The Linux desktop was so good that Apple and Microsoft could not help copying it at an astonishing rate. Full screen for ALL apps for the first time in Mac OS X Lion, anyone?

But while we, proud users, were showing off semi-transparent rotating desktop cubes to the Apple fanboys in the neighbourhood, William Jon McCann had a feeling of terrible insecurity. He, as the lead designer of Gnome3, felt that the Linux desktop was crap and something new, more apple-ish was required. At the same time Miguel de Icaza, the founder of Gnome, had already been a closeted Mac OS X user, waiting for the great coming-out moment. Allegedly, his sound was not working and he could not play videos on Linux. I’m at a complete loss here…

But anyway, Gnome3 was born, Gnome2 was discontinued, Ubuntu defaulted to Unity, and everybody else got real angry. There is a silver lining in the clouds though, thanks to Linux Mint, but it’s still a long way. But what caused this mayhem?

It’s called inferiority complex.

It’s harmful.

No, the desktop is not going away, and no, OS X and Windows were not better than the Linux desktop, and no, goodness is not measured by market share. These gentlemen were hankering after the wrong things from the Apple world. They wanted to copy looks and features and gardens and walls. They should have noticed something else:

Self-confidence.

It’s the ability to notice that you’re good at something. The first Mac OS from 1984 and the present OS X basically look the same. They stuck with their interface even in the valley of the shadow of death. Their user interface is still the same, while they have changed the internals to Unix. The same is true for the Linux kernel. The external interfaces never change. Linus’ bash binary from 1991 still runs.

Miguel de Icaza thinks Linus Torvalds is an arrogant low-level kernel guy. But the fact that you’ve been a guilt-afflicted closeted Mac-fag, does not mean that someone else with a healthy dose of self-confidence is arrogant. In fact Linus Torvalds is an extremely humble person. He goes to great lengths to protect his users. Yes, on the surface you see the “shoot-yourself-before-you-reproduce” and the “you-are-full-of-BS”, but the comforting self-mockery is always there, and it’s all for the users’ sake.

On the Gnome side there is McCann’s polished and politically correct corporate lingo, which in fact is full of ignorance, insecurity and bullshit. And they could not care less for their existing users. But it’s Linus’ fault, of course.

Go to therapy, get rid of your inferiority complex and start using mplayer.

Using ssh-agent on a Server

April 25th, 2012 subogero No comments

My new favourite distro is Debian Squeeze. I use some installations as servers and virtual machines. They all share a surprising feature for a 3 year-old Linux Noob:

No GUI

No desktops, no menus, no windows and no mice, just sshd and the Bourne Again Shell. I’ve been struggling with git fetch/push on such machines for a while, having to add the passphrase of my private key every time. Until now, that is.

Basic command-line installations of Debian Squeeze don’t run ssh-agent automatically like the GUI versions of popular Linux distros. The setup is up to the user or sysadmin.

My solution provides the following features:

  • ssh-agent runs on a per-user basis as a daemon (not per-system and not per-session)
  • user enters pass-phrases once per power-cycle of the machine (not once per logging in)

The solution is implemented in /etc/profile:

# SSH Agent
export SSH_AUTH_SOCK=~/.ssh/.ssh-socket
echo --- LIST ADDED KEYS ---
ssh-add -l
if [ $? = 2 ]; then
 echo --- ADD KEYS ---
 rm -f ~/.ssh/.ssh-{socket,agent-pid,script}
 ssh-agent -a $SSH_AUTH_SOCK 2>/dev/null >~/.ssh/.ssh-script
 . ~/.ssh/.ssh-script >/dev/null
 echo $SSH_AGENT_PID >~/.ssh/.ssh-agent-pid
 ssh-add .ssh*/id_rsa
fi

Adding keys to ssh-agent forever on a server might be a security risk, but defining a timeout is also possible, the example below shows one enough for a workday (8 hours):

ssh-add -t 28800 .ssh*/id_rsa

Mutt aka Bash Is Still King

December 5th, 2011 subogero 4 comments

I’ve had problems with sending emails from the command line before. On Windows. That’s how mapis was born. This time it’s the same story on Linux. I want to send an email from the command line with an attachment. The rather lovely Evolution does not support it.

In comes mutt, the even more lovely terminal based email client. But I don’t want to loose features:

  • Gmail IMAP access
  • integration with my Gmail contacts
  • Hungarian spell-check
  • mutt as my default mail client in Gnome, so Firefox uses it when Sending Link…

And while I’m at it, I want some new features as well:

  • editing email with vim (with Hungarian spell-check, obviously)
  • bonus: email desktop notifications, even when the client is not running

Installation

apt-get install mutt  # as root

My ~/.muttrc config file:

set from = "your@email"
set realname = "Your Name"
set imap_user = "your@email"
set imap_pass = "yourpassword"
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed = "+[Gmail],Drafts"
set trash = "imaps://imap.gmail.com/[Gmail]/Trash"
set header_cache = ~/.mutt/cache/headers
set message_cachedir = ~/.mutt/cache/bodies
set certificate_file = ~/.mutt/certificates
set smtp_url = "smtp://your@email:587/"
set smtp_pass = "your_password"
set editor  = "vi"
set query_command = "goobook query '%s'"
set sort = "threads"
set sort_aux = "last-date-received"

color normal white default
color index white default ~p
color index white default ~P
color index white default ~O
color index brightwhite default ~N
color tree red default
color hdrdefault cyan default
color quoted green default
color tilde white default
color signature blue default
color attachment brightyellow default
color status brightwhite green
color indicator black white

You’ve probably noticed vi as the editor, some options that don’t let you miss new posts to old email threads and a colour scheme that fits well into Linux Mint. Also goobook is mentioned, which can access your Gmail  contacts from the command line. Homework: find the goobook website on the internet! Then download and extract the source tarball, run

sudo ./setup.py install

Then create its config file ~/.goobookrc

[DEFAULT]
email: your@email
password: your_password

As the above config files store your password, don’t forget to change their permissions:

chmod 700 ~/.muttrc ~/.goobookrc

As to the Hungarian spell-check in vi, add a line to ~/.vimrc which maps it to <F7>, like some office tools:

map <F7> :setlocal spell spelllang=hu<Enter>

The first time you activate it, it will download the Hungarian database, then highlight the misspelled words with red. Move around them with [s and ]s and let vim suggest correct spelling with the z= key combo. It kicks ass indeed.

Mutt as Gnome’s default email client? Main Menu (I don’t use the Mint Menu), System, Preferences, Preferred Applications. Mail Reader. Choose Custom, then specify “/usr/bin/mutt %s” as the command. Run in terminal of course. Test with Send Link… in Firefox.

Now all is well. Just try to send a file attachment from the command line.

mutt -a foo.txt

opens mutt, which in turn asks for the mail recipient. Just type a part of the name or email, hit Ctrl-t, and mutt will complete the email address from your Gmail Contacts. Then enter a subject and voilá, vi opens up to edit the mail body. Edit, spellcheck, ZZ, y. Done.

And now for something completely different. Desktop notifications for new email, even when no email client is running. I’ve found a nice mutt-Gmail tutorial blogpost somewhere, I forget where. It contained a Python script for email notifications. I opened it. I got scared. 200 lines of code! I nearly gave up. But after  taking a courageous look I realized it just parsed the Gmail atom feed and called Gnome’s notify-send. Using a class and using an XML parsing module.

Python is a rather lovely language, but I have to say its adherents are famous for writing bloated code. I bet I can write a 10-line shell script for that. I ended up with 11 lines, but including the shebang and a configurable checking period. It’s among my Gnome Startup Applications:

#!/bin/sh
SLEEP=`echo $1 | egrep '^[1-9][0-9]*$'`
[ -z "$SLEEP" ] && SLEEP=300
USER=`sed -rn 's/^set imap_user = "(.+)"$/\1/p' ~/.muttrc`
PASS=`sed -rn 's/^set imap_pass = "(.+)"$/\1/p' ~/.muttrc`
while true; do
 EMAILS=`curl -u ${USER}:${PASS} https://mail.google.com/mail/feed/atom \
 | sed -rn 's/<name>(.+)<\/name>$/\1/p'`
 [ -n "$EMAILS" ] && notify-send "NEW EMAIL" "$EMAILS"
 sleep $SLEEP
done

Bash is still king.

Categories: Uncategorized Tags: , , , ,

Gnome3

November 29th, 2011 subogero No comments

I gave it a go, after I read a positive blog-post about it. So I installed Fedora16 as a new VirtualBox machine. Then I installed VirtualBox guest-additions to enable 3D-acceleration, without which one is confronted with the 2D fallback mode, which shall not be mentioned in civilised company.

Finally I was presented with the new shiny uncluttered Gnome Shell. I hit Alt-F1 to see the menu. There emerged the even more shiny semi-transparent Activities page. Surprisingly, it was rather empty. I wanted to start something like a browser or a terminal with the keyboard. So I hit the arrow keys, Tabs and stuff to get to “Applications” instead of “Windows”, or to the hierarchical menu on the right side. Nothing. In about 5 minutes – googling included – I have not found any key combination the Activities page recognizes. There is probably something like Ctrl-Alt-Shift-arrow, which needs 3 hands to operate.

So, rather sadly, I resorted to using the mouse and started a terminal. I was immediately presented with an unpleasant huge silver title bar. So much for uncluttered. So, yes, let’s customize the desktop theme. Right-click the desktop. Nothing. Hmmm. Alt-F1 for Activities, somehow I found Settings. It turned out all you can do is change the background image. Hmmm, indeed. Compiz will probably sort it out.

Or rather not. Compiz is not available. Good bye Rotating Desktop Cube, good bye Ring Switcher, good bye semitransparent Wobbly Windows. One might say I’m an effect-junkie, but the fact is these Compiz bells and whistles actually help you see what you do. On the Cube, you see what is on the next desktop. With a semitransparent moving window, you see where you place it. With the Ring Switcher after Alt-Tab, you see what window you choose. Which is not the case with Gnome3’s Alt-Tab, which displays icons only. Welcome back to the wonderful world of Windows XP.

Having mentioned terminals, I wanted to open a second one. Activities, click Terminal, and Gnome3, endeavouring to give satisfaction, returned me to my old Gnome-terminal. Thank you very much.

So back to customization. You cannot choose your fonts. You cannot choose your colours. You cannot choose your keyboard shortcuts. You probably can, but you need extensions and special config tools and config file editing. Need an extension to choose my fonts? Weird. The Windows XP registry springs to the mind. Not funny.

But c’est la vie, I yummed gnome-tweak-tool. Suddenly a whole new world of options opened up, like choosing fonts. Not colours, though. I’d say about 10% of the options of Gnome2-Compiz. At least I could select my favourite MetaBox window borders. Or rather the Metabox non-borders.

The issue of window borders brings me back to my favourite obsession, vertical space. Or in the case of Gnome3, the lack of it. You must have a panel, and you must have it on top. You must have a window title bar and you must a have a menu. In Unity, for a maximized window, the panel, the title bar and the menu are one. In Gnome2, you can place the panel to any side and make it auto-hide.

And sorry, but I have not seen any nice effect that necessitates 3D acceleration. Gnome3 does not look too good. It’s a desktop, which is a piece of furniture, which, by definition, must look good. Mac OS X looks good. Unity looks good. And Gnome2-Compiz simply blows everything else away.

Gnome2-Compiz was actually so bloody good that Apple copied many features from it. I still remember the day I first installed Jaunty Jackalope after living for years in a desert called Windows XP. I was amazed by the myriad of desktop customization options: Configurable window decoration! Configurable controls! Configurable panels and applets! Configurable hotkeys for everything! Semi-transparent terminals! A sane algorithm for placing new windows! Not even mentioning the rather mind-blowing Compiz stuff. And suddenly, Windows XP looks like an oasis of freedom compared to Gnome3.

What’s going on here? I’m probably very stupid. Too stupid use Gnome3. At least I’m in good company. Linus Torvalds can’t use it, either.

The Command Line Is Outdated

November 23rd, 2011 subogero No comments

The command line has been outdated for 20 years.

This is the claim I heard yesterday from a colleague, along with a statement that he needs useable interfaces. The revelation came during a discussion about git vs MKS Source Integrity*.

Why, one might ask, comes Windows 8 Server, for the first time in history, without a GUI?  Why do retarded Linux freaks still claim that the command line is way more effective than any GUI?

The shocking answer is that, surprisingly, the command line is our natural way of communication since the dawn of the human race. We have an organ to form and send text streams. It’s called the mouth. We have another pair of organs that receive text streams. The ears, ladies and gentlemen. We also have a way of batch-processing these messages. Some would call it reading and writing. Others call it literacy.

That’s the reason that, against all odds, the only remaining paradigm of the last half century of computing is Unix, which embraced TEXT as its core value. Everything is a file, in other words a stream of characters, text.

What is the very essence of the C language, the ultimate superclass of all superclasses, which is compatible with everything by definition? It’s this, the pointer to the universal byte stream:

void *

And we’ve just arrived to the most crucial question. Why do so many people still despise the command line? Exactly. Because it involves learning languages.

But come on! By the age of two, everybody has learned one. It’s not that difficult. Of course, we all start with GUIs. We click our toys. We play with the mother of all GUIs, our Mom’s b… erm… buttons.

But as time passes, our parents watch with ecstatic joy as we form our first text streams. They tell their friends about it. Then we go to school and what do we learn first? Scripting.

I’ll go further. The command line is older than the human race. Text is more universal than the universe.

In the beginning was the Word, and the Word was with God, and the Word was God.

Chew on that, you serial clickers.

* Some would propose a better name: MKS Source Disintegration.

Categories: Uncategorized Tags: , , , ,

CyanogenMod 7 Update

November 11th, 2011 subogero No comments

A few days after installation, I wanted to install ssh onto the phone. I turned out dropbear is installed by default, I just had to set up some keys.

Then, to my utter amazement, I found a bash directory in /etc. I typed bash, and suddenly there it was, the world’s favourite shell in all its glory and coloured prompt!

CyanogenMod 7 on MotoDefy

November 7th, 2011 subogero No comments

I’m happy to report that the Bluetooth issue with the helmet headset was due to a broken mic wiring. No battery problems either.

And now back to the actual installation of CM7 to Moto Defy. This description is based on two excellent and detailed articles in Hungarian on androidunderground.info:

And now let’s get down to business.

Precautions

Your phone could be bricked during the process. No warranties, blah blah blah.
Use the download links here. The internet is full of crap.
Fully charge the phone’s battery and use a laptop to avoid problems due to power failures.
I used the company laptop with Windows XP, because the rooting program is for Windows.
Back up your data. I did not, as contacts are synced with Google and all else is on the SDcard.

Backups are for whimps (Linus Torvalds)

1. Install official stock Froyo

Only if you have an older device which came with Android 2.1.

You need the Motorola drivers for the PC. Download if the USB connection does not work.

Motorola has released an official update program for Windows. Download. Search the net for other details.

2. Root Your Phone

Download the SuperOneClick program for your PC. There are many versions, and most don’t work with this phone. Use this link.

Allow USB debugging on the phone: Settings / Applications / Development / USB debugging

Connect phone to PC via USB. Pull down phone statusbar, tap USB Connection, select ‘Charge Only’ or ‘Motorola Phone Portal’.

On PC, start the SuperOneClick program (as admin on Win7). Click the ‘Root’ button. Wait 1-2 minutes until the ‘Device is rooted’ dialog pops up, click OK, close SuperOneClick.

Restart phone. Check whether rooting was successful by starting Terminal Emulator on the phone and typing ’su’. The Superuser app should pop up asking for permission.

3. Install 2ndInit ClockWork Custom Recovery

Allow unknown app sources on the phone: Settings / Applications / Unknown Sources.

Install the 2ndInit program on the phone. Download, copy to phone SDcard, On phone, start File Manager app, go to SDcard, find and click SndInitDefy_1.4_2.apk program, Install, Open.

Tap ‘Install 2ndInit Recovery’ button. Tap ‘Allow’ twice in the subsequent Superuser Request popups.

Disable USB debugging on the phone: Settings / Applications / Development / USB Debugging

Reboot phone, you will get into boot menu.

  • Select ‘+Boot –>’ with volume buttons, push power button
  • Select ‘+Set Default –>’ push power button
  • Select ‘+Normal –>’ push power button
  • Select ‘–Go Back’ push power button
  • Select ‘[Reboot System]‘ push power button

After this second reboot you get back to Froyo, but the CustomRecovery is installed already. We’re ready for the actual CM7 installation.

4. Install CM7

Download the lastest stable version and GoogleApps as well. Copy them both into the root folder of the SDcard.

Restart phone, after 8 seconds from start the blue LED is switched on (indicating that 2ndInit is working). Push Volume Down while blue LED is on to get into boot menu.

  • Select ‘+Recovery –>’ push power button
  • Select ‘[Custom Recovery]‘ push power button
  • Select ‘- wipe cache partition’ push power button
  • Select ‘- Yes – wipe cache’ push power button
  • Select ‘- wipe data/factory reset’ push power button
  • Select ‘- Yes – delete all user data’ push power button
  • Select ‘- install zip from sdcard’ push power button
  • Select ‘- choose zip from sdcard’ push power button
  • Select ‘update-cm-7….zip’ push power button
  • Select ‘Yes – Install …’ push power button
  • Select ‘- choose zip from sdcard’ push power button
  • Select ‘gapps-gb….zip’ push power button
  • Select ‘Yes – Install …’ push power button
  • Select ‘+++++Go Back+++++’ push power button
  • Select ‘- reboot system now’ push power button

Your phone will now boot into CyanogenMod 7. The first boot is slow and you should go through a lot of initial settings. Have fun.

Cooking

November 1st, 2011 subogero No comments

This post is about the richness of hacker-lingo. Let’s take, for instance, custom ROMs for Android devices. The real name of the phenomenon is actually “cooked ROM”. Let just savour the beauty of this expression for a moment…

After some frustration with the slowness and general crapness of the official Motorola Froyo for my Defy, I’ve finally made up my mind and installed CyanogenMod-7 last Friday. I’ve followed the instructions of an excellent guide in Hungarian. General impressions:

I’m root by default and busybox is installed. Good start.

The amount of configuration options is mind-boggling.

The status bar is black at last. And the home screen auto-rotates as well.

It’s bloody fast.

It works.

It plays the most fluid liquid drum and bass all day long from my favourite internet radio. It plays offline music and navigates in the car. It GPS-tracks my cycling routes. It can read and write email. It can browse the web. It syncs my contacts between the phone and Evolution automatically via Google. It takes pictures. It browses pictures, much better and faster than the utterly crap Moto-Gallery. Blimey, it can even make phone calls!

It reads the Bible in Hungarian, Greek and Hebrew, just to name a few. Thanks to the new app and-bible. It’s sooooo much better than YouVersion. Swipe left for next chapter. Get to the Hebrew Aleppo codex with one tap. Local search. No pretend-to-be-social-internet-junkiness. Just do one thing extremely well. Respect.

Back to CM7, I have a week impression that it’s a bit heavier on the battery than the stock firmware. But it needs to be confirmed.

Tomorrow is the big day. We’ll test whether it connects via Bluetooth to the helmets of the great Defy-using-and-motorcycling community at the office. Which the original Moto firmware does not. Keep fingers crossed.

Gits and Bugs

October 24th, 2011 subogero 2 comments

One may wonder what was happening in the last few months. Everyone knows about the Euro-crisis. A certain Mr Erdogan has been trying to revive the Ottoman Empire, sharpening his Unix-skills, especially bashing, on Israel.  Mahmoud failed to turn Judea and Samaria into a Judenrein state at the UN. It also turned out that a single Israeli soldier is worth 1027 heroic Palestinian freedom fighters. What’s more, Muammar Kadhafi, in a markedly Perl-like fashion, said:

keep $power or die $!

Yes, but what about the real important stuff, you may ask. Oh, I see what you mean! Here it is.

I needed a recursive git-grep function to scan submodules as well. So I wrote one. Along with a vim-plugin, which is a beautiful piece of plagiarism, but that’s open source for you!

http://github.com/subogero/git-grep-recursive-vim

I got acquainted with gdb, the GNU Debugger, courtesy of Richard Stallman. Typical of him, it prints 2 pages of licensing info and political agenda when started up. But after you get rid of that,

alias gdb='gdb -q'

what a brilliant piece of software it is! Easy, comfortable, fast, debugging on the command line. It’s just incredible. Gdb is a bit better explained here:

http://betterexplained.com/articles/debugging-with-gdb/

I rewrote my calculator, because one had to type too many uppercase letters for hex numbers. It’s all lowercase now. And it’s called “szg”, and no, not after my initials. It means SZámolóGép, which is Hungarian for calculator. Nothing to do with Hungarian notation, though. Which one of my colleagues turned out to actually like. Strange taste. It must give a deep satisfaction, when after 2 years of maintenance “u8Foo” has become a signed long.

Anyway the new calculator is available on github:

http://github.com/subogero/szg

At the office, I’m now co-developing a rather large project in git with a colleague. Lots of fun…

Having mentioned Muammar Kadhafi, there was a lot of hype about the death of Steve Jobs recently. A much more important person has passed away too: Dennis Ritchie, creator of the C programming language, co-creator of Unix with Ken Thompson. As a tribute, some quotes from the two heroes:

Obviously, the person who had most influence on my career was Ken Thompson.
Dennis Ritchie
That brings me to Dennis Ritchie. Our collaboration has been a thing of beauty.
Ken Thompson 
Categories: Uncategorized Tags: , , , ,