Archive for 2010

How to tar a list of files

If you want to tar a multiple files you must write a file containing a list of file to backup and the use this command: cat listoffiles.txt | xargs tar czvf yourbackupname.tgz – or tar zcvf yourbackupname.tgz $(cat listoffiles.txt)

FacebookTechnotiziePlaxo PulseLinkedInTwitterWordPressGoogle BookmarksGoogle ReaderStumbleUponTechnorati FavoritesShare
Read the rest of this entry »

Setup NAT on Mac OS X

$ sudo sysctl -w net.inet.ip.forwarding=1 $ sudo natd -interface en1 $ sudo ipfw add divert natd ip from any to any via en1

FacebookTechnotiziePlaxo PulseLinkedInTwitterWordPressGoogle BookmarksGoogle ReaderStumbleUponTechnorati FavoritesShare
Read the rest of this entry »

How to ping from php

< ?php function ping($host) { exec(sprintf('ping -c 1 -W 5 %s', escapeshellarg($host)), $res, $rval); return $rval === 0; } $hosts_to_ping = array('127.0.0.1'); ?> < ?php foreach ($hosts_to_ping as $host): ?> < ?php echo $host; ?> < ?php $up = ping($host); ?> < ?php echo $up ? 'on' : 'off'; ?> < ?php endforeach; ?>

FacebookTechnotiziePlaxo PulseLinkedInTwitterWordPressGoogle BookmarksGoogle ReaderStumbleUponTechnorati FavoritesShare
Read the rest of this entry »
 
WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera