wtorek, 16 czerwca 2009

How to get X.509 certificate from CMS/PKCS#7 signature

openssl pkcs7 -in signaturefile.sig -inform DER -print_certs -text

sobota, 13 czerwca 2009

Display a command result in new Xfce terminal window

Sometimes you just want to display a result, as for ls:

xfce4-terminal -H -e ls

But sometimes it makes sense to display results continuosly, like for htop or elinks:

xfce4-terminal -e htop

How to get executable shell scripts from Subversion repository

All you have to do is to set svn:executable property on the file

svn propset svn:executable on somescript.sh

svn commit

Especially important when done on Windows (SVN client should set this automatically if executable file is being added to version control on Linux)

Keyboard shortcut for "Add to version control" in eclipse

I am really fed up with right-clicking and choosing "Add to version control". I defined a keyboard shortcut then. 

Press Ctrl Shift L twice. On "Keys" preference page find "Add to version control", preferably using the relevant search box. When - "In windows". I chose "Ctrl+Shift+Alt+C" so that it won't interfere with anything (I hope).

piątek, 22 maja 2009

End-of-line characters conversion between Windows and Linux

Just started to work for a project where the majority of the people use Windows. Quick fix for ^M occuring in shell scripts:

sudo aptitude install tofrodos

and then

find . -name '*.sh' | xargs dos2unix -d

(could be with exec, but for a small number of files it does not really matter)

sobota, 9 maja 2009

A cryptographic hash of an empty byte array does exist. Honestly.

An hour or so spent and finally the reason found - no data. That test proves it in a way:

@Test
public void testNullDigest() throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA1");
System.out.println(ArrayUtils.toString(md.digest(new byte[0])));
}

The output:

{-38,57,-93,-18,94,107,75,13,50,85,-65,-17,-107,96,24,-112,-81,-40,7,9}


Exactly the same as the one I was getting. In particular, different from the expected one (suprise). I should make some constant ;-/

sobota, 2 maja 2009

Quick search in Midnight Commander

Just press Alt+s and then start typing the name.