Author Archives: admin

disable ipv6 address on linux or linode

if you want to remove ipv6 address run the below command:
sysctl -w net.ipv6.conf.all.autoconf=0
sysctl -w net.ipv6.conf.eth0.autoconf=0
sysctl -w net.ipv6.conf.all.accept_ra=0

to make it permanently add it to the sysctl.conf

Also on Debian Etch (probably on newer too), without setting the accept_ra, the system will autoconfigure using the Link local adress (fe80..)

Further more, automatic address configuration and router discovery will be disabled if the host itself is a router and accept_ra is not 2, i.e
net.ipv6.conf..forwarding=1
and
net.ipv6.conf..accept_ra=0 or net.ipv6.conf..accept_ra=1.

reference:

http://superuser.com/questions/33196/how-to-disable-autoconfiguration-on-ipv6-in-linux

enable virutal memory on linux debian

Most of the time, virtual memory is enabled by default on linux, in case it’s not there, run below commands:
cd /var
touch swap.img
chmod 600 swap.img
dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
mkswap /var/swap.img
swapon /var/swap.img
echo "/var/swap.img none swap sw 0 0" >> /etc/fstab

And you can use this command to check for memory status:
free

All-In-One Video Downloader

Download below and start to use it now. Also feel free to leave comment below.
download

All-In-One Video Download can download video from almost every video sites from internet. For example, not only it can download from youtube, it will also be able to download from vimeo, dailymotion and many more.

You don’t have to know exactly what sites it support, when you feel need to download a video, just paste in the url and start the download button, most of time, it will be able to download it successfully for you.

Screenshot:

All-In-One Video Downloader

Download below and start to use it now. Also feel free to leave comment below.
download

curl download files with the file name from server

To download files with the file name from server with curl, you need to specify this command:
curl -O -J -L

And this is the explanation of the command switch used:
-O, –remote-name Write output to a file named as the remote file
-J, –remote-header-name Use the header-provided filename (H)
-L, –location Follow redirects (H)

get rid of weird #text when you load a xml document into php DOMDocument

When you load a xml file into DOMDocument in php, you can encounter some weired #text node during the iteration. I searched around, and found this solution, just put a line of code like below:
$dom = new DOMDocument;
$dom->preserveWhiteSpace = FALSE;

And then you are done!

And last not least this is where I found the answer, it gives a thoroughly explanation:

http://stackoverflow.com/questions/4598409/printing-content-of-a-xml-file-using-xml-dom