Blog Spot!


SSL Self-Signed Certificates

selfsignedcertificate.com

Apache Configuration

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 must also enable apache to listen on port 443, which is done using the directive Listen 443.

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

Added on 20.Apr.2015
Tags: ssl certificate self-signed

Linux - wget Basic Authentication

NO Authentication:

wget http://website.com/get/articles

With Basic Authentication:

wget --user=username --password=password http://website.com/get/articles

Added on 23.Mar.2015
Tags: linux request wget authentication

How To Set Up SSH Keys

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

digitalocean

Added on 21.Mar.2015
Tags: ssh key public private linux

Linux: Display a countdown or stopwatch timer in a terminal?

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

superuser.com

Added on 20.Mar.2015
Tags: linux bash terminal clock countdown stopwatch

Create a quick REST API using Slim framework

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.

full article

Added on 19.Mar.2015
Tags: rest php slim microframework

Search


PHP Libraries


Carbon lib / docs
Idiorm lib / docs
Image Workshop lib / docs
lorenzos/Minixed lib / docs
Parsedown lib / docs
PHP Paginator lib / docs
PHP Redis lib / docs
QrCode lib / docs
Requests lib / docs
Slim lib / docs
Spyc lib / docs
TWIG lib / docs
Upload lib / docs
Validation lib / docs
Zebra Image lib / docs

JS Libraries


AJV lib / docs
BackboneJS lib / docs
Bootstrap Notify lib / docs
C3.js lib / docs
ChartJS lib / docs
FastMD5 lib / docs
HighlightJS lib / docs
jQuery-Storage lib / docs
JS-Cookie lib / docs
Leaflet JS lib / docs
LowDB lib / docs
Marked lib / docs
NeedlyJS lib / docs
ParcelJS lib / docs
RequireJS lib / docs
Swig lib / docs
Toastr lib / docs
Underscore lib / docs
ValidateJS lib / docs
top