You need the following ssl configuration in your VirtualHost:
<VirtualHost donvercety.tk:443>
ServerName donvercety.tk
SSLEngine on
SSLCertificateKeyFile /etc/apache2/ssl/donvercety.tk.key
SSLCertificateFile /etc/apache2/ssl/donvercety.tk.cert
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
# ...
</VirtualHost>
You will also need all the settings and sections required for a regular HTTP host, such as DocumentRoot and
You can create a key and certificate yourself instead of downloading them from this page. This makes your key more secure. To generate a key:
openssl genrsa -out donvercety.tk.key 2048
And the certificate:
openssl req -new -x509 -key donvercety.tk.key -out donvercety.tk.cert -days 3650 -subj /CN=donvercety.tk
NO Authentication:
wget http://website.com/get/articles
With Basic Authentication:
wget --user=username --password=password http://website.com/get/articles
Step 1: Check for SSH keys:
$ ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist
Step 2: Generate a new SSH key:
$ ssh-keygen -t rsa
# Generating public/private rsa key pair.
You can press enter here, saving the file to the user home
Enter file in which to save the key (/home/username/.ssh/id_rsa):
It's up to you whether you want to use a passphrase. Entering a passphrase does have its benefits: the security of a key, no matter how encrypted, still depends on the fact that it is not visible to anyone else. Should a passphrase-protected private key fall into an unauthorized users possession, they will be unable to log in to its associated accounts until they figure out the passphrase, buying the hacked user some extra time. The only downside, of course, to having a passphrase, is then having to type it in each time you use the Key Pair.
Enter passphrase (empty for no passphrase):
The public key is now located in /home/username/.ssh/id_rsa.pub The private key (identification) is now located in /home/username/.ssh/id_rsa
Stopwatch format:
date1=`date +%s`; while true; do
echo -ne "$(date -u --date @$((`date +%s` - $date1)) +%H:%M:%S)\r";
done
Countdown timer:
seconds=20; date1=$((`date +%s` + $seconds));
while [ "$date1" -ne `date +%s` ]; do
echo -ne "$(date -u --date @$(($date1 - `date +%s` )) +%H:%M:%S)\r";
done
You can combine these into simple commands by using bash (or whichever shell you prefer) functions. In bash, add these lines to your ~/.bashrc (the sleep 0.1 will make the system wait for 1/10th of a second between each run so you don't spam your CPU):
function countdown(){
date1=$((`date +%s` + $1));
while [ "$date1" -ne `date +%s` ]; do
echo -ne "$(date -u --date @$(($date1 - `date +%s`)) +%H:%M:%S)\r";
sleep 0.1
done
}
function stopwatch(){
date1=`date +%s`;
while true; do
echo -ne "$(date -u --date @$((`date +%s` - $date1)) +%H:%M:%S)\r";
sleep 0.1
done
}
You can then start a countdown timer of one minute by running:
countdown 60
You can countdown two hours with:
countdown $((2*60*60))
or a whole day using:
countdown $((24*60*60))
And start the stopwatch by running:
stopwatch
During a recent client project, I frequently needed to access a remote database table and update the same for certain fields. This was accomplished using phpMyAdmin on the server. However, it was getting tedious and was prone to accidental updates and deletes. Also, a couple of other developers also needed to make changes to certain fields on the remote database from their local server.
This is all a tedious process and prone to errors. One solution was to create a quick REST api wrapper around the remote database, using which developers could update the database table without any risk of corrupting the data and also with the added benefit of updating the table programmatically.
This post shows how to create a simple REST API using Slim framework. Slim is a PHP micro framework which lets you write quick PHP web applications. Here we will use it to build a REST api. Although I cannot show the exact database schema used, as this would not make sense without the context, I’ve provided a simple schema for the examples. The schema shows a students table which provides student scores along with their names.