...making Linux just a little more fun!

2-Cent Tips

2-cent Tip: Checking remote hosts for changes

Ben Okopnik [ben at linuxgazette.net]

Mon, 20 Sep 2010 19:07:05 -0400

On occasion, I need to check my clients' sites for changes against the backups/mirrors of their content on my machine. For those times, I have a magic "rsync" incantation:

rsync -irn --size-only remote_host: /local/mirror/directory|grep '+'

The above itemizes the changes while performing a recursive check but not copying any files. It also ignores timestamps and compares only file sizes. Since "rsync" denotes changes with a '+' mark, filtering out everything else only shows the files that have changed in size - which includes files that aren't present in your local copy.

This can be very useful in identifying break-ins, for example.

* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *

2 cent tip: reading Freelang dictionaries

Jimmy O'Regan [joregan at gmail.com]

Sun, 5 Sep 2010 14:58:30 +0100

Freelang has a lot of (usually small) dictionaries, for Windows. They have quite a few languages that aren't easy to find dictionaries for, so though the coverage and quality are usually quite low, they're sometimes all that's there.

So, an example: http://www.freelang.net/dictionary/albanian.php

Leads to a file, dic_albanian.exe

This runs quite well in Wine (I haven't found any other way of extracting the contents). On my system, the 'C:\users\jim\Local Settings\Application Data\Freelang Dictionary' translates to '~/.wine/drive_c/users/jim/Local\ Settings/Application\ Data/Freelang\ Dictionary/'. The dictionary files are inside the 'language' directory.

Saving this as wb2dict.c:

#include <stdlib.h>
#include <stdio.h>
int main (int argc, char** argv)
	char src[31];
        char trg[53];
	FILE* f=fopen(argv[1], "r");
	if (f==NULL) {
		fprintf (stderr, "Error reading file: %s\n", argv[1]);
	while (!feof(f)) {
		fread(&src, sizeof(char), 31, f);
		fread(&trg, sizeof(char), 53, f);
		printf ("%s\n   %s\n\n", src, trg);

The next step depends on the contents... Albanian on Windows uses Codepage 1250, so in this case:

./wb2dict Albanian_English.wb|recode 'windows1250..utf8' |dictfmt -f --utf8 albanian-english dictzip albanian-english.dict (as root:) cp albanian-english.* /usr/share/dictd/

add these lines to /var/lib/dictd/db.list : database albanian-english { data /usr/share/dictd/albanian-english.dict.dz index /usr/share/dictd/albanian-english.index }

/etc/init.d/dictd restart

and now it's available: dict agim 1 definition found

From unknown [albanian-english]:

agim dawn

<Leftmost> jimregan, that's because deep inside you, you are evil.
<Leftmost> Also not-so-deep inside you.

[ Thread continues here (10 messages/18.69kB) ]

2-cent Tip: A better screen, byobu

afsilva at gmail.com [(afsilva at gmail.com)]

Mon, 27 Sep 2010 17:58:59 -0400

The screen command with pre-set status bar, and cool (easy to remember) shortcuts, like F3, F4, F5 and a configurable menu on the F9 button.

yum install byobu

Got a nice screenshot at: http://www.mind-download.com/2010/09/better-screen-byobu.html


An HTML attachment was scrubbed... URL: <http://lists.linuxgazette.net/private.cg[...]nts/20100927/26297595/attachment.htm>

[ Thread continues here (2 messages/1.74kB) ]


Talkback: Discuss this article with The Answer Gang

Copyright © 2010, . Released under the Open Publication License unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 179 of Linux Gazette, October 2010