Skip navigation.

matze's blog

Compress string with zlib into gzip compatible format

As zlib doesn't have a function to compress directly a string into a gzip-compatible format i've written a function to do so:

#include <zlib.h>
void gzip_str(const char* in, const int inlen, char* out, int *outlen){
z_stream zlibStreamStruct;
zlibStreamStruct.zalloc = Z_NULL; // Set zalloc, zfree, and opaque to Z_NULL so
zlibStreamStruct.zfree = Z_NULL; // that when we call deflateInit2 they will be
zlibStreamStruct.opaque = Z_NULL; // updated to use default allocation functions.
zlibStreamStruct.total_out = 0; // Total number of output bytes produced so far
zlibStreamStruct.next_in = (Bytef*)in; // Pointer to input bytes
zlibStreamStruct.avail_in = inlen; // Number
int res = deflateInit2(&zlibStreamStruct, Z_DEFAULT_COMPRESSION, Z_DEFLATED, (15+16), 8, Z_DEFAULT_STRATEGY);
if (res!= Z_OK) return;
do {
zlibStreamStruct.next_out = (Bytef*)out + zlibStreamStruct.total_out;
zlibStreamStruct.avail_out = *outlen - zlibStreamStruct.total_out;
res = deflate(&zlibStreamStruct, Z_FINISH);
} while ( res == Z_OK );
deflateEnd(&zlibStreamStruct);
*outlen=zlibStreamStruct.total_out;
}

See the Zlib Faq: http://www.zlib.net/zlib_faq.html#faq20

Videoüberwachung = mehr Straftaten ?!

Ein Gutachten zur Wirksamkeit von Videoüberwachung fördert zu Tage, dass die Überwachung überhaupt nichts bringt.

Markdown

Ich blogge ja schon eine weile und bin eben auf Markdown gestoßen.

Markdown erzeugt aus einer sehr einfachen Text-Syntax HTML-Seiten mit einer ganz ansehnlichen Formatierung.

Für Drupal habe ich auch ein markdown Modul gefunden, jetzt blogge ich ohne die ganzen umständlichen Tools, mal sehen wie sich das bewährt.

Mehr Privatsphäre!

Wer Adblock Plus verwendet sollte Facebook blockieren (schon aus Prinzip!):
||facebook.com^
||fbcdn.net^

Facebook pfeift zu sehr auf Datenschutz. Auch sehr spannend: Entwicklung der Standardeinstellungen für die Privatsphäre.

Howto get rid of the "Brother XP spl Service" (BrSplService / brsvc01a.exe)

This is a service from a Brother Printer, if you don't have such a printer, try the Brother Printer Driver Uninstall Tool.

I've posted this, because i didn't find an other easy solution. When i manually deleted the service, the service show up after a reboot.

Howto restore Default IDE-Drivers/migrate Windows from Virtualbox to KVM

If you want to migrate a Physical to a Virtual Host or vice versa then you can use the attached files to enable the default IDE drivers on the running system.

before doing so, please make a backup! :-)

I used the Script to convert a Windows XP running in VirtualBox to be executed in KVM. Without doing so i got a 0x0000007B bluescreen.

The .reg file is from Microsoft, the .cmd should be self-explaining :)

kvm supports .vdi files so the VirtualBox machine can be run directly with kvm:

kvm -hda windows.vdi

The image then finally can be converted with

qemu-img convert -O qcow2 windows.vdi windows.qcow2

If that doesn't work the VBoxManage tool from Virtualbox should do the job too:

VBoxManage clonehd –format RAW windows.vdi windows.img

 

Git repository aufräumen / neu packen

mit dem Befehl

git gc --auto

wird ein git repository neu gepackt und optimiert. Bei mir wurde ein Repository von 43MB auf nur 16MB geschrumpft. Immerhin eine Platzersparnis von ~70%.

Noch als Hinweis: das optimieren dauert wirklich lange weswegen ich den --auto parameter immer verwende, da dieser den optimierungsprozess nur startet, wenn das aufräumen notwendig ist!

Anonym im Internet?

Wer glaub anonym im Internet unterwegs zu sein sollte sich mal den Artikel "Panopticlick: EFF studiert Browserspuren im Internet" bei golem.de durchlesen.

Durch die Browserkennung und die installieren Plugins lässt sich ein Benutzer doch meist sehr eindeutig identifizieren. Selbst die Plugins Adblock und Noscript (die man aus Gründen der Sicherheit sowieso installieren sollte) für Firefox helfen nur bedingt, da Noscript leider nicht ganz einfach zu konfigurieren ist und die Browserkennung sich auch nur schwer anonymisieren lässt.

Auf der Webseite Panopticlick von der EFF kann man sich selbst ein Bild davon machen, welche Informationen der Browser auch ohne Cookies schon von sich Preis gibt. Dabei ist aber noch zu beachten, dass die Webseite die IP-Adresse nicht berücksichtigt welche noch weite Informationen liefert.

 

 

 

Backup and Restore NTFS-Partition with Unix tools

With ntfs-3g.secaudit it is possible to backup and restore file permissions of a NTFS-Filesystem:

ntfs-3g.secaudit -b /dev/mapper/loop1p2 > sec.data

and to restore:

ntfs-3g.secaudit -se /dev/mapper/loop1p2 sec.data

This makes it possible to backup a complete NTFS-volume with rsync/tar/... and the ntfs-acls.

Syndicate content