Archive for the ‘fun’ Category

The best website in the world…

Friday, May 20th, 2011

…is commandlinefu.com. Just to remind me that all can be done with a command line 🙂

forgotten ping

Monday, January 24th, 2011

Today I noticed a “forgotten ping” running on a server: 4 millions and half of transmitted packets!
forgotten_ping

compiling bacula-sd 2.4.4 on AIX

Tuesday, January 11th, 2011

Recently I compiled an old release of Bacula on an AIX 5.3 host (oslevel command shows “5.3.0.0” as output), using a gcc 3.3.2 version. My need was to make a bacula-sd binary file. To end my compilation I performed some quick and dirty hack.
First, I downloaded and installed the MySQL includes and client, as a prerequisite:

# rpm -Uvh MySQL-client-3.23.58-2.aix5.1.ppc.rpm MySQL-devel-3.23.58-2.aix5.1.ppc.rpm

after downloading the tar.gz file, I uncompressed and opened it in a temporary directory. Then I moved to the bacula-2.4.4 directory and run the configure command with several options:

./configure -prefix=/usr/local/bacula -enable-largefile -disable-libtool -with-pid-dir=/usr/local/bacula/var/run -with-subsys-dir=/usr/local/bacula/var/run/subsys –disable-conio –enable-build-stored –with-mysql

Then, I opened the Makefile to comment out the line with .PATH variable definition

#.PATH:         .

and I added some line to the ./src/bacula.h file before the pthread.h inclusion:

/* Beginning of the code added by hand */
#define __SIZEOF_PTHREAD_BARRIER_T 20
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4

typedef volatile int pthread_spinlock_t;

typedef union
{
char __size[__SIZEOF_PTHREAD_BARRIER_T];
long int __align;
} pthread_barrier_t;

typedef union
{
char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
int __align;
} pthread_barrierattr_t;
/* end of the added code, next line was the original one */
#include <pthread.h>

in the file ./src/stored/stored.h I made me sure to include mtio.h in the right place:

//#ifdef HAVE_MTIO_H
//#include <mtio.h>
//#else
//# ifdef HAVE_SYS_MTIO_H
# include <sys/mtio.h>
//# else
//#   ifdef HAVE_SYS_TAPE_H
//#   include <sys/tape.h>
//#   endif
//# endif
//#endif

then in src./lib/bsys.c I commented out the initgroups definition:

/*
#ifdef HAVE_AIX_OS
extern “C” int initgroups(const char *,int);
#endif
*/

finally, as root, I commented out the line 104 of /usr/include/sys/mtio.h file (Yes, I know, It’s an ugly solution)

#ifndef _MTEXTEND_H
/*  #include <sys/mtextend.h> */   /* XXXXX commented in order to compile bacula */
#endif

After making all theese changes, I was able to end the bacula-sd (and other) part of bacula suite.
Before the installation, You may find useful to strip the binary files

# cd ./src/stored
# strip bacula-sd bscan btape bcopy bextract bls
# make install

At this point I tested my bacula-sd starting it in foreground, verbose and debug mode

# /usr/local/bacula/sbin/bacula-sd -v -f -d 516

and I started my backup test.

editing the AIX /var/adm/wtmp file

Monday, October 25th, 2010

I can’t see any useful reason, but if You like to modify the output of the “last” command on an AIX system, You can convert to an ASCII file the /var/adm/wtmp file, editing it and then rebuild it. E.g.

/usr/sbin/acct/fwtmp < /var/adm/wtmp > /tmp/temp.file
vi /tmp/temp.file
/usr/sbin/acct/fwtmp -ic < /tmp/temp.file > /var/adm/wtmp
rm /tmp/temp.file

a memory game

Tuesday, April 13th, 2010

Some day ago I wrote a simple javascript game. To play You have to find any couple of images by clicking on the images.
Please feel free to download and modify sources and images.

encoding and decoding web content

Saturday, January 16th, 2010

Today I played with Leet Key, a Firefox addon. This is an useful plugin for converting, encoding or decoding any text string taken from a web page with a simple right click.

To try this, just go to the addon download page, click the “add to firefox” button and then install the plugin.

Once rebooted your firefox browser, You can select and right click any text to convert it into several format.

leetkey usage

leetkey usage

Ajax for fun

Thursday, May 14th, 2009

Ajax (Asynchronous JavaScript and XML) allows You to make a lot of nice effects. Using rico and prototype libraries it is very simple to write some funnny game like this.
I wrote this javascript game in a few thanks to a removed post on http://www.janeirostudio.com website and the ImageMagik command

$ convert orchis_360.jpg -crop 90×90 orchis

to split the main image into 16 sub-images.