Ubuntu: Add a new swap file

create the new file with your desired size (usually swap file is as big as RAM)
Attention: dd count parameter means number of blocks (thus 4GB = 4 million blocks with blocksize 1K)


SWAPFILE=/home/swap.file
SWAPMEGABYTES=4096

#create the new file
BLOCKCOUNT=$(($SWAPMEGABYTES * 1024))
dd if=/dev/zero of=${SWAPFILE} bs=1024 count=${BLOCKCOUNT}

#format the file with swap file system:
mkswap ${SWAPFILE}

add the new file with type swap to fstab:
vi /etc/fstab

add new entry for swap file:
/path/to/swap.file       none            swap    sw              0       0

remount fstab:
mount -a

activate swap for all entries in fstab:
swapon -a

show if everything worked well and swap space has changed:
free

ssh access without password

client —–> server

create the client’s ssh key (if not existing already)

ssh-keygen -t rsa

if you’re adding the first key, just copy the public key ~/.ssh/id.rsa_pub to the server

scp ~/.ssh/id_rsa.pub user@server:.ssh/authorized_keys2

to append another key, use:

cat ~/.ssh/id_rsa.pub | ssh user@server 'sh -c "cat - >>~/.ssh/authorized_keys2"'

ramdisk

sudo mkdir /media/ramdisk
sudo mount -t ramfs ramfs /media/ramdisk

free vectors and stuff

http://www.bittbox.com/category/freebies/

PHP remote debugging in Eclipse PDT

in order to start remote debugging your php scripts right from your development server, you’ll need the Zend debugger for your server’s platform from here:

http://www.zend.com/en/products/studio/downloads

Chose the right ZendDebugger shared library for your PHP version (e.g. 5_2_x_comp/ZendDebugger.so) and copy it to your server – most likely where your other PHP extensions reside (in my case a turnkey LAMP stack —> directory /usr/lib/php5/20060613+lfs)

Now add a little information to the end of your php.ini. Make sure, you use the right php.ini file (if you’re unsure: consult phpinfo() under the key “Loaded Configuration File”)

zend_extension = "/usr/lib/php5/20060613+lfs/ZendDebugger.so"
zend_debugger.allow_hosts = 192.168.43.1
zend_debugger.expose_remotely=always
zend_debugger.passive_mode_timeout=600

Of course adjust the first to lines accordingly. Allowed host is the IP address of the PC that’s running your Eclipse IDE. For more information on these directives, consult TFM 😉
Just a small notice on ‘allowed_hosts’: You can define full netmasks here, such as 192.168.0.0/16 – that means every IP in 192.168.*.*  – perfect for home DHCP or teamwork.

If your installation work was succesful, you’ll see a new paragraph in phpinfo() output that refers to as “Zend Debugger”

nokia pc suite – force a full sync

simply delete the cached data stored in a folder like:
C:\Users\YOUR_USERNAME\AppData\Roaming\Nokia\PCSync\SynchData\

recover data notes

recovering data from an sdcard is possible with oss:

create an image of your drive using dd:

dd if=/dev/disk1 of=/path/to/my/image.img

get foremost at
http://foremost.sourceforge.net/
then extract and make it

you can specify a type, e.g. MOV

./foremost -t mov -i /path/to/my/image.img -o /path/to/my/recovered/files

turnkey linux

turnkey linux is a nice and small virtual appliance that comes as jeos (just enough operating system).

it offers several ways to access it after it’s running:

  • shell in browser (http, port 12320)
  • webmin interface (http, port 12321)
  • ssh

unfortunately the vmware tools didn’t work. so i reinstalled them:

mount vmware tools in vmware player

mount cdrom
sudo mkdir /media/cdrom
sudo mount /dev/scd0 /media/cdrom

unpack and install vmware tools

cd /tmp
tar xvzf /media/cdrom/VM*.gz
cd vmware-tools-distrib
sudo ./vmware-install.pl

install vmware tools

sudo apt-get install build-essential
sudo apt-get install linux-headers-`uname -r`

configure vmware tools

/usr/bin/vmware-config-tools.pl

show virtual disk mount points
vmware-toolbox-cmd disk list

zero out empty spaces
(creates a huge file that takes all the free space on your harddisk and writes zero’s in it. thus it should be better compressable.
cat /dev/zero > zero.dat ; sync ; sleep 1 ; sync ; rm -f zero.dat

shrink disk /
vmware-toolbox-cmd disk shrink /

grep find blabla

grep -Iri

The age of features is dead; Welcome to the age of User Experience.

The age of features is dead; Welcome to the age of User Experience.
This is the tagline of Aral Balkan’s blog with useful posts like that