Archive for July, 2010

Installing VSFTPD

July 30, 2010

1.Install it from the ports
cd /usr/ports/ftp/vsftpd
make config
make install clean
2.Edit the vstfpd.conf file in /usr/local/etc/vsftpd.conf to customize the settings
3.To run it from the command line:
/usr/local/libexec/vsftpd &
3.To make it run at startup create an executable file in /etc/rc.d
#! /bin/sh
#
/usr/local/libexec/vsftpd &
4.Restart computer

Posted in FreeBSD Unix No Comments »

How to save a remote image to local disk

July 30, 2010

$image_url = “http://example.com/image.jpg”;
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $image_url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
// Getting binary data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$image = curl_exec($ch);
curl_close($ch);
// write to local file
$f = fopen(’/home/www/path/image.jpg’, ‘w’);
fwrite($f, $image);
fclose($f);
// output to browser
header(”Content-type: image/jpeg”);
print $image;
?>

Posted in Apache/PHP No Comments »

How to delete .svn folders recursively

July 26, 2010

There is a very simple way of doing this. We use the find command to get all the s/.v .svn folders in a folder. The next step is to pass the output of this command to the delete command .
So  to list all .svn folders in the current folder:
find . -type d -name .svn
Next pass [...]

Posted in FreeBSD Unix No Comments »