Delete data from hard drive securely
It’s common for people to say that it’s necessary to overwrite the hard drive many times before the data becomes unrecoverable. This is however just a myth. The probability of recovering only a single byte is less than 1%, so it’s very unlikely that someone can restore something much bigger like 100 MB.
In other words, overwriting the hard drive many times is just a waste of time. Writing 0:s on the whole hard drive is sufficient and can be done with tools like dd.
More information:
http://www.h-online.com/newsticker/news/item/Secure-deletion-a-single-overwrite-will-do-it-739699.html
Drawing rectangles SDL
Drawing rectangles can become such a pain in the ass after drawing them a couple of times. I made a helper function that makes this easier.
void FillRect(int x, int y, int w, int h, int color) {
SDL_Rect rect = {x,y,w,h};
SDL_FillRect(screen, &rect, color);
}
I want to add a 100×150 rectangle at the position (25,25) with the color white.
FillRect(25,25,100,150,0xFFFFFF);
Great, no more headache and code memorizing.
Using the OpenBSD package system
The package system in OpenBSD consists of pre-compiled programs that can be managed with the pkg tool. The packages may not necessarily contain the same kind of security and realibility as the base system, but pkg is useful for installing “third party” software.
1. Create the environment variabel PKG_PATH with the value of the right directory to fetch the packages.
export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/4.5/packages/i386/
2. Add this line into the startup file, ~/.profiles so we don’t have to export it every time we use pkg.
Installing a package
pkg_add -i firefox
Removing a package
pkg_delete firefox
Information about installed packages
pkg_info
Mount ntfs drive on Linux
1. Install ntfs-3g.
2. Create a folder in /media or /mnt (mkdir /media/windows)
3. Use fdisk -l to get the name of the NTFS drive (example: dev/sda1)
4. Add the drive into /etc/fstab so it mounts automatically.
/etc/fstab
/dev/sda1 /media/windows ntfs-3g defaults 0 0
Using X with SSH
I was working on the school computers from home trough SSH and needed to use X. Using the “-X” parameter gave me error messages when I used the keyboard mouse if I remember correctly. This worked without any error messages though.
ssh -Y -l user server
Encrypting mail in Thunderbird using GnuPG and Enigmail
Thunderbird is a mail user agent developed by Mozilla. GnuPG is an encryption program (free software) that uses the standard OpenPGP. This standard is based on encryption using a private and public key. The private key is used to decrypt the data while the public key is used to encrypt the data.
The Thunderbird add-on Enigmail, provides an “back-end” interface to GnuPG so the user can use Thunderbird to encrypt/decrypt mail. After installing Enigmail, generate a keypair. This will create a public and private key for the current account. The public key is meant to be distributed so other people can send mail encrypted to you. The private key however, is important NOT to distribute. Since it is used to encrypt the messages sent to you with your public key. The public key is usually uploaded to a keyserver.
It’s possible to search for public keys on the keyservers and add public keys into a local list and configure Thunderbird to encrypt all messages by default (supposing the public key to the person in question is added into your key list). Both Thunderbird, GnuPG and Enigmail, are very useful indeed : )
For more information about GnuPG and Enigmail:
http://www.gnupg.org/
http://enigmail.mozdev.org/home/index.php
Compile SDL/OpenGL applications using g++
This is how I compile a C++ program with SDL and the OpenGL libraries GL and GLU.
g++ -o appname opengl.cpp `sdl-config –libs –cflags` -lGL -lGLU
sdl-config –libs –cflags is used to get the library path and include path for SDL. This can be used instead of manually specifying the libraries for SDL.
Burn DVD in Linux using dvd+rw-tools
Install dvd+rw-tools with your package manager or download it from here. And then invoke the following commands…
Format disc where /dev/dvd is the device name:
dvd+rw-format -force /dev/dvd
Burn the directory (/home/user/stuff) onto the DVD:
growisofs -Z /dev/dvd -R -J /home/user/stuff
More information:
http://fy.chalmers.se/~appro/linux/DVD+RW/
leave a comment