Sandbox image

About Sandbox

This is my sandbox... I put here everything I might consider useful or important as far as PCs and MACs are concerned.



 * Implements the pair as known from the STL
 * @author zib
public class CPair<T1 extends Serializable & Comparable<T1>, 
					T2 extends Serializable & Comparable<T2>> 
					implements Serializable, Comparable<CPair<T1, T2>>
	private static final long serialVersionUID = 1918789127256937138L;
	/** The first pair value */
	public T1 first;
	/** The second pair value */
	public T2 second;

	CPair(T1 f, T2 s){
		first = f;
		second = s;
     * Compares two pair values. Starts with comparing 
     * the first values. If the comparison states that
     * they are equal then returns the comparison result 
     * of the second values, otherwise returns the compa-
     * rison of the first pair 
    public int compareTo(CPair<T1, T2> o) {
        if ( (first == null && o.first == null) ||
        		(second == null && o.second == null)) 
        	return 0;
        if (first == null || second == null) return -1;
        if (o.first == null || o.second == null) return 1;
        int c1 = first.compareTo(o.first);
        if(c1!=0) {
        	return second.compareTo(o.second);
        } else {
        	return c1;
A handy implementation of a comparable pair container for java


sudo touch /.quota.ops.user
sudo touch /
sudo quotacheck -a
sudo quotaon -a
sudo edquota <user>
#bug?# sudo edquota -t
this set of scripts should set up your quota on mac os x (should work for both normal and server version). The files you create at the beginning need to reside in the root of quota enabled volume -- they indicate. The volume is quota enabled. Remainig commands set up quota management. edquota is used to set up per user quota -- see man for details. I did not manage to get the edquota -t to function. I dunno if it is a bug, or not.


echo abc | xargs -i echo {}def
echo ghi abc | awk '{printf("%sdef%s\n",$2, $1)}'
xargs is one of the best *nix tools however, one of the not-so-obvious problems is how not to put the passed arguments at the end of the xarged command. The solution for that is the usage of the -i switch and {}, which get replaced by the passed argument. Hence the example to the left will produce output of "abcdef" and NOT "defabc". You can get even more flexible with awk.
find .|grep ~$|xargs -r rm have you ever wondered how to feed data from pipe into the rm command -- well the xargs is solution to your problem. The above script deletes recursively all backup files from current directory and all subdirs. The -r on xargs tells it not to run rm on empty input.
grep -v pattern matches all the text EXCEPT for the pattern given.
/etc/sysconfig/network/ifcfg-eth-id-xx:xx:xx:xx:xx:xx have you ever encountered the probem with SuSE when it complained about network configuration for the device not being found? Well, ususlaly this happens in the VMWare environment, when you switch the networks, or if you clone the suse installation to another PC. The problem is that network card configuration is MAC-bound and stored in the location given on the left. To get everything back to working just change the MAC address part of the file name to the one your carrent NIC has.
fuser -u /mount/point whenever you get an error "umount: /mount/point: device is busy" you can easily track the user/process responsible for the files opened on the device. Having done that merciless kill PID should get your umount working again
those two command line tools allow you to list all your System V IPC resources and delete them correspondingly. For more info just man them.
Use to respectively:
Trim the shortest match from the end, trim the longest match from the beginning, trim the longest match from the end, trim the shortest match from the beginning
for i in *.dat
  if [ -d "$i" ]
     echo $i (dir)
     echo $i (file)
Bash loop and condition in one. Lists all the files and dirs from the current directory matching given pattern.
nedit -import path/to/pattern/file.pats execute to import/use a new syntax and highlightning definition scheme/file into the nirvana editor.


cvs update -d use to update the source tree from cvs AND create any missing directories
cvs -d host:/path/to/root import -m "Import message" -I ! \
path/to/new/module vendor_tag release_tag
execute IN the source code top level directory to import the whole new source tree into CVS. The Source tree is not changed.
cvs admin -kb filename execute to change the type of the filename to binary. Remember to re-commit since the file in repository is probably damaged.
$Source: /home/cvs/ROOT/zib/sandbox_en.html,v $
$Revision: 1.16 $
$Author: cvs $
$Date: 2005/06/01 20:00:31 $
this is a good CVS header to be placed in your comment section of the souurce code files. It is updated automatically with every checkout. Very useful when used with TeX files.
cvs st -R | grep ? | sed s/\?\ //|xargs -i cvs add \{\} A little command line replacement for lacking recursive cvs add
cvs st -R | grep ? | awk '{print $2}'|xargs -i cvs add \{\} This is an equivalent to the above recursive one-liner, this time with awk
svn propset svn:ignore [pattern] [directory] Tell svn to ignore files matching [pattern] in the [directory].
svn:keywords (Date, Revision, Author, URL, Id)
svn:eol-style (native, CRLF, CR, LF)
These are the special properties for files stored in svn. Use svn propset, svn propget or svn propedit to manipulate them.


#define MSGMAX 4056 /*<= 4056*/ defines the maximum size of the message for the SYSTEM V message queues. Located in the file: linux/msg.h
cc -fPIC -c code.c
cc -shared code.o -o
use to create a shared library out of the c source code file. Note that you may need to pass the -G parameter instead of the -shared parameter. This depends on your compiler.


\newcommand{\cvsstamp}{$\ $Date: 2005/06/01 20:00:31 $\ \bullet\; $RCSfile: sandbox_en.html,v $\
\bullet\; $Revision: 1.16 $\ \bullet\; $Author: cvs $\ $ }
this is a lightweight version of the auto-updated CVS header, for use with the LaTeX environment.
$\textnormal{Some text.}$ use inside the math environment of LaTeX to typeset normal texts - i.e. with the defaullt document font.


gnuplot point and line types This is a handy graph showing most of the gnuplot point and line types. The index on the y axis shows the combination of point and line type, e.g., line at 9 uses point type 9 and line type 9. Click on the thumbnail for a larger image. You can also get the postscript version here.