Kryptering med PHP

Lite simpel kryptering för PHP

    define(’SALT’, ’din hemliga nyckel’);
    function encrypt($text)
        return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, SALT, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));

    function decrypt($text)
        return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, SALT, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)));

How to install Lexmark X1270 under Linux

To get the Lexmark X1270 working under Linux you can use the drivers for the Lexmark Z600. (Only the printer will work, not the scanner) I had some problems to get it working at first, there was some libraries or whatever it was called that was missing so I added 3 files I needed in a archive for you to download.

But before you do that, add these PPA’s to the packet manager:
deb karmic main
deb-src karmic main

Inside the archive:

Just unpack it and doubleclick on the files to install them.

Download Lexmark x1270 Drivers for Linux here.

Bra program för Linux

Det här är mest en post för mig själv som ska hjälpa mig komma ihåg alla program vid omformatering/ominstallation.

Deluge – Bra alternativ till uTorrent.
Geany – Bra texteditor, kan även använda syntax för tex HTML och PHP osv.
Filezilla – FTP-Program.
Mumble – Ventrilo-alternativ.
Pidgin – MSN och ICQ-klient.
XChat – IRC Chat.
Gnome Do – Starta program snabbt osv…

Sony Ericsson G900 – Piece Of Shit

My girlfriend just bought a Sony Ericsson G900. This cellphone is worthless! It’s so slow! It sometimes take 2-3 seconds just to get into submenus and it’s laggy everywhere! It’s so slow! It’s useless! She’s very unhappy with it. I tried to update the firmware and turning off effects and other bullshit to make it faster but it didn’t work. The Sony Ericsson G900 is a piece of shit. Don’t buy this crap-phone.