Automate letsencrypt certificate renewal

I recently switched from self signed certs to free SSL certs from letsencrypt and for the first time I could load my https url without getting the annoying prompt from chrome due to self signed certificates. The only problem is the certs expire pretty fast in about 90 days as of this writing, while this is nothing to complain about since the certs are free handling the renewal each time manually would be a pain and also leave me in a bind in case I forgot to do it.
I decided to automate the renewal process to save myself the hassle of having to do it manually and found two resources here and here on how to do it, I went with a combination of the two methods as my requirements were different.
I wanted the renewal to be run from a script to support email notification on success or failures which is similar to the first source and use the webroot plugin to perform renewal as it has lesser steps to perform renewal reducing any failure points during the process like the second source. The script needed to be able to run everyday and check cert expiration I didn’t want to hard code the cron job to run based on how long the certs are valid that way if letsencrypt changes the life of the certs no change is required on my side.
Let’s get started I won’t cover the install as that’s covered by letsencrypt site, I would advise you to read the different install methods and choose the one that best fits your needs.
After performing the install
Create your config file which will contain the arguments submitted to letsencrypt api I named mine “”

rsa-key-size = 4096
server =
text = True
authenticator = webroot
agree-tos = True
renew-by-default = True
email =
webroot-path = /your/webserver/path

Run the command used to create/renew your certs, which creates the certs for you and shows you the path to find them.

/root/.local/share/letsencrypt/bin/letsencrypt -c /path/ -d -d auth

Only run the above command if you haven’t created your certs or are ready to renew your current certs, otherwise just grab the script file and add it to your cron. Make sure to change the emails and file paths based on your setup. I have commented out the echo statements and only enable then for testing

For someone doing this for the first time locate your ssl.conf file used by your server and set the paths to the new certs

SSLCertificateFile /etc/letsencrypt/live/
SSLCertificateKeyFile /etc/letsencrypt/live/
SSLCertificateChainFile /etc/letsencrypt/live/

Once you are done setting up head over to SSLLabs and test your certificate is recognized as expected, then setup a cron job to run the script daily .

0 2 *  * * sh /path/

VP8/9 vs h264/5 for personal videos

Recently I needed to encode some clips taken with my phone to a web optimized format since the videos were already in mp4 my initial thought was to keep them in mp4 format h264 video/AAC Audio.
First things first to get the videos to a web optimized format a re-encode would be needed so I had to accept that some drop in quality was going to happen. That was the easy part. A little googling and I found that libfdk_aac is the best AAC codec currently to use with ffmpeg, so I uninstalled my RPM installed ffmpeg and tried to compile my own. Getting sources for all the codecs I needed to have in my ffmpeg was pretty straight forward, but the build failed with some make error gcc was having issues building for the platform. This left me with 2 options wipe the OS fedora 20 and upgrade to the latest 21 or spin up a VM and use that to do the compile. The second option seemed like the way to go but I still wasn’t sold on the idea of having to do all this extra effort just to encode some phone clips.

During this thinking period when I was trying to get some time to go with option two I came across an article about vp9 and it hit me I was willing to jump through all this hoops to use a proprietary codec while there was a comparable opensource codec I could use with ffmpeg out of the box. So I re-installed ffmpeg from RPM spent about an hour tweaking some scripts to do the conversion and rotation of the clips.
Played back the newly encoded webm files and I could barely notice a difference with the original files, they were also 50% – 70% the size of the original files. Getting my video hosting application to work with webm files took about another hour as it was not on the list of supported extensions this was uprising since it’s an open source application.

Right now am feeling pretty happy with my choice as expected safari and IE don’t support webm so for those needing to watch the clips am just telling them to use Chrome or firefox. While the video hosting application allows me to share the clips with outsiders for my internal consumption of the clips I use Plex Media Server once they add support for webm to their native clients I will be converting the whole collection of clips from mp4 to webm.

Update: I received some feedback from family members and they are able to view the videos without a problem, so looks like I will be sticking with VP8/9.

Restoring wordpress from database

I messed up the permissions on my box and on restart three quarters of the services would not come up so doing a database backup was out. All my previous DB backups had the plugins still active. So when I tried to restore using them the blog is viewable, but when I try to log in I get a blank page on checking my Apache logs I saw the following error

Cannot use string offset as an array in wp-includes/capabilities.php on line 116

Restored database a couple of times nothing worked, tried upgrading & updating database nothing worked. Finally just installed WP from scratch with blank database. Opened up PhpMyadmin replaced new WP tables with tables from old WP DB backup, skipped table wp_options as it broke the new WP and both user tables as I had already setup the new user data on install, but I guess if you want to keep the old user data you can transfer these too.
Now I just made a backup of wp_options after restoring all the settings e.g blog name etc and turning off all plugins. This way next time all I have to do is just switch this table with the one from a backup whose plugins were still on at backup and am good to go.

Movies list by year of release

Being a movie’s lover every now and then I try to get a list of movies released within several months or a whole year and most sites on the net just list the top ten or at most top 60. But sometines yiou want to find a movie that did not make it to any of those lists and all you have is a release year. You can go to and they list for you all the movies made within a particular year and break it down by the month. This saves me a lot of googling when trying to find a movie I want. You can also get into advance free movie screenings or buy discounted movie and concession tickets, all this in one convinient place so check it out if you are into movies.

Watch Tv episodes and Movies Online

We have all watched Tv videos and movies online, the video is mostly choppy and the quality not that good, I found a site which has some very good quality videos with most of the latest stuff. They also have a player which combines vlc in it meaning you will pretty much be able to play anything out there. It also has a handy feature as it also enables tou to download your movies for offline viewing or streaming them in HD quality.

To check it out go to

Date Edited Auto-Update

I was using dreamweaver to edit my webpages which uses it’s own auto update on save date code<!– #BeginDateformat:Am1 –>May 5, 2005<!– #EndDate –> (Dreamweaver’s Auto-Update-on-Save Date Code). When I switched to bluefish as my main editor the auto update code wouldn’t work. So I looked around and found a php code to get the same thing done. Just place it anywhere you want the date to appear

<?php echo date(‘F j, Y’, filemtime(__FILE__));?>

If you want to store it to a variable you can do

$variable_date = date(‘F j, Y’, filemtime(__FILE__));

You can exchange filemtime with filectime if you want to display the date the file was created.

Star trek

CBS has released the original star trek series videos on youtube so if you got some time to pass take a look. You really become aware of how much technology has advanced since then but to give credit where it’s due they also did some amazing stuff considering whatever little technology they had at the time compared to now.

Gmail shortcuts

Are you an avid user of gmail and would like to learn some shortcuts to make maximize your email sessions, the guys at google have put together a tutorial on couple of easy shortcuts that can help you do this, they have also given descriptions to help you memorize them check them out here. There are more shortcuts available but this are ok to start with. Happy Gmailing.