Web2PDF – Free Online Website to PDF Converter

If you have ever needed to generate a PDF of a website, then www.web2pdf.com.au has got to be the easiest way to do it.

The website allows you to enter a URL or Website Link and at a click of a button, you receive a PDF. It really is that simple. Best of all is that it is free and requires no additional software installs.

How does Web2PDF work?

Web2PDF will visit the website you tell it to, it will then read the page and convert whatever it find there into a PDF. It mean you can have a PDF of a website in a couple of seconds. All you need to to is:
Step1. Enter the URL
Step2. Click “Convert” button and your PDF is ready for you to download.

When Should I Use a Website to PDF converter?

If you are visiting a website and would like to save that page with all the images and information into a single document, you can copy the URL and Web2PDF it using the above steps.
Perhaps you need to PDF an itinerary, a coupon code or a ticket – all you do it copy the link and paste it into Web2PDF.

Add Web2PDF on Your Own Site

Web2PDF allows you to add a button on your on website that allows any visitors to convert any page into a PDF with one click. Once a user clicks a button, the PDF will be created and downloaded for the user. All you need is to add one link on your site and we handle the rest. The link will tell our site to create the PDF and the user can download it without even leaving your site.

Oh! did we mention this can be done for free!

More information about this can be found on the Web2PDF Button Page.

Go Check It Out!

Click Here to visit Web 2 PDF (www.web2pdf.com.au) – your free online website to pdf converter.

Perl Ping Script to check remote server or website

Here is a surprisingly simple code snippet to perform a ping to check if a remote server or website is up. It create a new Net::Ping object and then pings the server. We can optionally specify a port to see if a specific port is responding on the server which can be very useful if we want to know if a service is still up and running such as MySQL or Apache.

A Perl Ping Script can be very useful and it can be used to make sure a website or server is up and can make our lives easier if we are monitoring multiple servers.

#!/usr/bin/perl -w

use Net::Ping;

# Host can be either an IP or domain name
my $host = "www.google.com";
#optionally specify a timeout in seconds (Defaults to 5 if not set)
my $timeout = 10;

# Create a new ping object
$p = Net::Ping->new("icmp");

# Optionally specify a port number (Defaults to echo port is not used)
$p->port_number("80");

# perform the ping
if( $p->ping($host, $timeout) )
{
        print "Host ".$host." is alive\n";
}
else
{
        print "Warning: ".$host." appears to be down or icmp packets are blocked by their server\n";
}

# close our ping handle
$p->close();

Quick, easy and very effective.

Common Ports List – Most Commonly Used Port Numbers

List of Commonly Used Ports

Below is a list of common ports and the service it is associated with I find are most commonly used. If you feel there are ports that should be on this list, please leave a comment or contact me.

Updated 17 May 2012 to include ports recommended by DHost

Port Description TCP UDP
20 FTP – data port (File Transfer Protocol)  
21 FTP – command port (File Transfer Protocol)  
22 SSH (Secure Shell)  
23 Telnet  
25 SMTP – Sending Mail (Simple Mail Transfer Protocol)  
43 WHOIS – Domain Name Lookup  
53 DNS (Domain Name System)
67 DHCP – Server (Dynamic Host Configuration Protocol)  
68 DHCP – Client (Dynamic Host Configuration Protocol)  
80 HTTP – Webservers such as Apache2 and IIS – more info on accessing websites on alternate ports
110 POP3 – Receiving emails (Post Office Protocol, version 3)  
123 NTP (Network Time Protocol)  
143 IMAP – Receiving emails (Internet Message Access Protocol)
443 SSL – Webserver with encryption (Secure Socket Layer)
Plesk Control Panel also uses this port
1433 MSSQL – Database (Microsoft SQL Server)
2082 cPanel  
2083 cPanel over SSL  
2095 cPanel Webmail  
2096 cPanel Webmail over SSL  
3128 Squid Proxy – Default Squid Proxy Port. Port 8080 is another common port for squid.  
3306 MySQL – Database
8080 HTTP Port (Alternate port generally used when port 80 is already in use – more info)  
8443 Plesk Control Panel  

 

Accessing a website on a different port

When you access websites, you are, by default, accessing them on the port 80 since this is the default web port used by websites. This means that http://www.darian-brown.com/ is the exact same as http://www.darian-brown.com:80/ (where :80 specifies the port number). However if the website server is using another port such as a more commonly used alternate port 8080, then you will need to specify the non-default port in the following format: http://www.example.com:8080/ where www.example.com is the website domain or IP address and 8080 is the port number the website is running on.

FTP, FTPS, SFTP and SCP

FTP, FTPS, SFTP and SCP are all protocols in which we communicate and transfer files between servers and computers. Here is a brief overview of what each one is.

FTP

FTP stand for file transfer protocol. FTP is a protocol most commonly used when uploading and downloading files from a servers. The least secure method of sending and receiving files since their is no encryption and your username and password are sent across the internet to the server in plain text.

FTPS

Just think of FTPS as FTP over SSL. FTPS is just like FTP above, however its data gets encrypted over a SSL connection. It is a much more secure way of sending sensitive files.

SFTP

Secure File Transfer Protocol should not be confused with the FTP or FTPS protocol. Basically this means you are using FTP over SSH. Although they server the same purpose in transferring files, SFTP is a lot more secure than FTP.

SCP

SCP or Secure Copy – is a method used to copy files from one SSH server to another. It is similar to the FTP protocol however you are executing a ssh copy from either a local server to a remote server or even from a remote server to a different remote server.

Disable Root SSH Access – Howto on Securing SSH

You should never allow anyone to ssh directly into your server as root as this could be a serious security risk should anyone be able to brute force your password. Instead, you should disable root ssh access which will force people to login as a normal user and then switch to root.

Here are some tips on securing SSH on your server. This is not everything you need to do but it is a good place to start.

Disabling Root Access

Disabling root access is surprisingly easy. First login to your server as root or a normal user and then su to root.

ssh username@yourserver.com

Second, edit your sshd_config file. Note that there is also a ssh_config file which you don’t need to edit in this tutorial.

vi /etc/ssh/sshd_config

Thirdly, find the section with the line shown below, uncomment it if it isn’t already and change the yes to a no.

PermitRootLogin no

And lastly, save the file and restart sshd.

/etc/rc.d/init.d/sshd restart

After you have completed the above, no one will be able to login as a root user but instead have to switch to root after logging in as a root user.

Additional changes to further secure SSH

Disable X11Forwarding unless of course, you absolutely need to use it. To do this, edit the sshd_config as shown above and find the line as shown below and change it to NO.

X11Forwarding no

Change the SSH protocol from version 1 to the more secure version 2. To do this, edit the sshd_config as shown above and find the line as shown below and change it to 2 instead of 2, 1.

Protocol 2

Further Information

If anyone has any further information, I will be happy hear about it so email me or post a comment below.

How To Setup IP Address in Linux

In this guide, you will be shown how to setup the IP address of a computer running Linux. Before we know which way to configure your network card, you need to know if you want to use a static or dynamic IP address.

Broadband made better. Superfast broadband, unlimited downloads and free award winning UK based customer service available 24/7 – O2 BroadBand

Static IP vs DCHP IP

Depending on your network configuration, you will need to either use a static IP address which is commonly used on servers on corporate networks. A static IP address is manually entered in and doesn’t change.

You could also use a dynamic IP address which can be assigned to your computer via a DHCP service. DHCP is more common in home networks. DHCP is a service that runs on your network that will automatically setup your network ip address. Before DHCP can assign your computer a IP address, you need to setup your network interface to use DHCP

Editing the Network Interface

All your IP address information be it dynamic or static is stored under your network interface file which can be found under the path /etc/network/interface. To edit this file you may need root or sudo access. To edit the file enter the following:

sudo vi /etc/network/interfaces

Inside this file you will notice a loopback device. Ignore this part as we want to focus on the eth0 interface – or interface 0. If you have multiple network interfaces, you may see eth0, eth1, etc.

Setup DHCP for Network Interface

Find the section that has iface eth0 (or whichever interface you need – eth1, eth2, etc). and change it to match below. Thats the only configuration you. Now you need to restart your network interface to bring in the changes (shown below).

allow-hotplug eth0
iface eth0 inet dhcp

Setup Static IP for Network Interface

If you need a static ip address, then edit your interface file to be similar to below. Note that your ip, netmask and other items will need to match your own network range.

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.20
netmask 255.255.255.0
network 192.168.0.1
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.2

Note that network and broadcast are optional entries and if omitted will be automatically detected.

Restart Networking Interfaces

In order for the above changes to come into effect, you need to restart your network interface. You can do this by running the following command:

/etc/init.d/networking restart

Sometimes you will find your interface doesn’t come online when restarting so entering in ifup will bring it back up where eth0 is the network interface you configured.

ifup eth0

And inversely, if you wanted to bring the network interface down, you would type in:

ifdown eth0

Caution! Typing in ifdown will take the network interface offline and drop your network connection so don’t running this command remotely!

Quickest Way To Remove Empty Elements From A PHP Array

Here I will show you the quickest way to remove empty values from an array.

The first way is slow but the most logical way of approaching this. Luckily the second example is the quickest and also pretty simple way. Use the second way, trust me, you will love it.

The slow but simple way – don’t use

Here is the most straight forward way of doing this. It works but I will show you a quicker way afterwards.

<?php

// our massive array with set values and empty values
$array = array(...);

foreach( $array as $key => $value )
	if( $value == "" ) unset($array[$key]);

?>

The quickest yet simple way – use this way

And here is the quickest way I have found to remove the empty values from a PHP array. Below we fetch a list of keys from the array that is empty (using the php function array_keys) and then unset each of those values.

<?php

// our massive array with set values and empty values
$array = array(...);

// get the empty array keys using array_keys
$keys = array_keys($array,"");

// foreach empty key, we unset that entry
foreach ($keys as $k)
	unset($array[$k]);

?>

Simple yet surprisingly quick.

Set Apache Log Permission Using Logrotate

If you have ever wondered why your log files randomly change permissions each night. Logrotate could be up to its tricks. Similar to the other article I published on Why is apache randomly restarting which explains why logrotate could be causing apache to restart randomly.

Each time logrotate runs its course, it will compress, rename and remove older files. This causes some of your log files to be empty or to no longer exist (since then have been compressed and renamed). Luckily logrotate will attempt to recreate these files and will set the correct permissions for it.

Once the logs are rotated, logrotate will restart apache which effectively recreates any missing log files. The permissions that it gets are determined by the config file for logrotate.

Edit the logrotate apache file which under debian is usually found under:

vi /etc/logrotate.d/apache2

Inside this file and most logrotate config files, you will see an entry like this

create 640 root adm

This basically tells logrotate to create any missing files, with the permissions of 640 (640 being the standard unix permisson bits) and root as the user with adm as the group.

Simple as that!