Author: sepedatua

I am nothing special, of this I am sure. I am a common man with common thoughts and I’ve led a common life. There are no monuments dedicated to me and my name will soon be forgotten, but I’ve loved another with all my heart and soul, and to me, this has always been enough.
I am nothing special, of this I am sure. I am a common man with common thoughts and I’ve led a common life. There are no monuments dedicated to me and my name will soon be forgotten, but I’ve loved another with all my heart and soul, and to me, this has always been enough.

How to tar.gz

tar is a program which combine several files into one (eg: files.tar). gz or gzip is a program to compress files (eg: files.gz). Both are Linux programs. A tar.gz file is a resulting file from several files combined together and then compressed. To combine and compress a folder: tar czf filename.tar.gz /path/to/some/folder To extract a tar.gz file: tar -zxvf filename.tar.gz…

Read More »

How to backup and restore PuTTY settings

PuTTY is a free implementation of Telnet and SSH for Win32 and Unix platforms, along with an xterm terminal emulator. It is written and maintained primarily by Simon Tatham. Official PuTTY site is: http://www.chiark.greenend.org.uk/~sgtatham/putty/. PuTTY is an open source software and its free, licensed under MIT license. I’ve been using PuTTY for years, its easy to use. So far, only…

Read More »

How to check validity of an URL

How to check validity of an URL. 1. Using Regex if (ereg(“^(http|https|ftp)\://[a-zA-Z0-9\.-]+\.[a-zA-Z0-9]{1,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\._\?\,\’/\\\+&%\$#\=~-])*$”, $url)) { echo ‘URL Correct’; } else { echo ‘Bad URL’; } This will validate URL with http, https and ftp schema. 2. Using fsockopen $url = parse_url($url); $conn = fsockopen($url[‘host’], 80); if (!$conn) die(‘Cannot connect!’); fwrite($conn, “GET {$url[‘path’]} HTTP/1.0\r\nHost: {$url[‘host’]}\r\nConnection: close\r\n\r\n”); $header = fgets($conn); if (preg_match(‘|HTTP/\S+\s+[2-3]\d\d|i’, $header))…

Read More »