Year End Stats Plugin v1.0 release

I just released v1.0 of my Year End Stats WordPress plugin just in time for you to write your year-end review posts.

This release adds a lot of new features and is a mandatory update.

Continue reading »

Posted in Plugin Releases | Tagged , , , | Leave a comment

Joined 10up

After being “officially unemployed” for about a month (and after taking a nice break 😉 ) I have joined 10up.

Continue reading »

Posted in Random/Personal | Tagged , , | 15 Comments

Goodbye Yahoo

Today was my last day at Yahoo and for the first time in my decade long career I am “officially unemployed” 😉

Continue reading »

Posted in Random/Personal | Tagged , | 16 Comments

Custom themes for PuTTY

This post has sat in my draft folder for more than 5 years. I was doing some cleaning and found that I didn’t publish this post and since it is still relevant I thought of pushing the publish button.

Being a web developer, most of the time I would be staring at PuTTY. I got sick of the default bright colours of PuTTY and was searching for ways to customize the display of my PuTTY window.

After some research, I found pre-packaged custom themes for PuTTY created by Ilya Grigorik. These themes are available as .reg files. You can directly download and use them or if you want, you can further customize them for your needs.

Below is the screenshot of the different themes that are available.

putty-terminals

Wow! now my eyes have something pleasant to stare at, most of the times 😉

Posted in Unix/Server Stuff, Web Programming | Tagged , , | Leave a comment

Automatically send unique errors (with count) from Apache error log as email

Sometime back I wrote about a simple awk script that I wrote which allowed me to find unique errors from Apache error log files.

After I wrote that script I found myself executing that script every day in the morning to figure out if there were any errors in my sites. After a couple of days I wrote another script to automatically parse the error log file and email me if there were any errors. As usual I thought of writing about it here so that it would be useful for someone else as well 🙂

Continue reading »

Posted in Python, Unix/Server Stuff | Tagged , , | 5 Comments

Read data from Google Sheet into a Python Pandas DataFrame

Recently I have done lot of data analysis in Python (more details about this in another post) and have started to like Pandas a lot. The other day I had to process some data from a Google Sheet and was wondering whether I could read the data as a Pandas DataFrame and after a quick search found the gspread package and within a few lines of code I was able to read data from Google Sheet into a Pandas DataFrame.

Continue reading »

Posted in Python | Tagged , , | 4 Comments

WP Github Gist plugin now supports the new Gist API

Like my Twitter Avatar plugin, even my WP Github Gist plugin was broken recently due to changes in the underlying API that my plugin was using. This time it was because of the changes in the Gist Embed API.

Continue reading »

Posted in Plugin Releases | Tagged , , , , , | Leave a comment

Twitter Avatar plugin now supports the new Twitter API

Because of the recent changes in Twitter API, my Twitter Avatar Reloaded WordPress plugin stopped working. I rewrote the way my plugin communicates with Twitter and updated the code to use the new API and now my plugin works again.

New Twitter Backend

Instead of rewriting the entire Twitter backend again, I am not using the excellent wp-twitter-api, provided by @timwhitlock which allows you to easily communicate with Twitter API from your WordPress plugin.

If you are a WordPress plugin developer and want to communicate to the Twitter API from your WordPress plugin, then I would highly recommend you to use wp-twitter-api, instead of creating your own.

Setting up Twitter App

The new version of the Twitter API needs you to make authenticated calls even to get some basic information about a twitter screen name. So after you installed the plugin you need to follow these steps so that the plugin could interact with the Twitter API.

  • Register a Twitter application at https://dev.twitter.com/apps
  • Note the Consumer key and Consumer secret under OAuth settings
  • Log into WordPress admin and go to Settings > Twitter API
  • Enter the consumer key and secret and click ‘Save settings’
  • Click the ‘Connect to Twitter’ button and follow the prompts.

Download

This is a mandatory update. You can download the latest version of the Plugin from the Plugin’s homepage or install it using the Plugin installer.

Feedback

Please keep the feedback coming and if you want me to add any new features or find a bug, please leave a comment or post about it in twitter.

Posted in Plugin Releases | Tagged , , , | Leave a comment

How to print unique errors(with count) from Apache error logs

After I moved to WordPress Multisite recently, I had to closely watch the Apache error log file for a couple of days to make sure that there weren’t any configuration mismatch.

Initially I used run the tail command to view the errors, but then I quickly realized that if there is a frequent error, then it becomes extremely difficult to find out other non frequent errors.

Command

After some fiddling with the awk and sort commands, I came up with the following one liner that prints the unique errors with their count.

Explanation

awk script is executed for each line in the error log file.

Field Separator

The -F directive is used to specify field separator. If you look at a single line in the apache error log file, you will notice that each field is enclosed by [ and ].

awk allows us to specify multiple field separators by enclosing them between []. That’s what we are specifying in -F[\[\]]

Filtering out lines that contain error

After splitting the fields, we need to filter out the lines that contain the term error in the fourth field. That’s what happens in the next part of the command. Basically the part $4 == "error"{print $7} prints the seventh field, which has the real error message if the fourth field is equal to the string “error”.

Sorting the error messages

The next step is to sort all the error messages. This is done by piping the output to the sort command.

Finding unique error messages and counting them

The next step is to find the unique error messages and then count them. This is done by piping the output to the uniq command. The -c flag does the counting.

Sorting the messages by frequency

The last step is to sort the messages again by frequency and print them. This is done by the last sort command. The -n flag sorts by numbers and the flag -r does the sorting by descending order.

Posted in Unix/Server Stuff | Tagged , , , , , | Leave a comment

How To Unfreeze Frozen SSH Tabs In Mac Terminal App

I use the Mac Terminal App a lot to ssh into remote servers. It all works great except for a single annoyance. If I leave the ssh tab open without any activity for sometime or put my Mac to sleep, then the tab gets frozen and becomes unresponsive. It takes a couple of minutes for it to log out of the server and become responsive again, so that I can reuse the tab again.

Whenever this happens, I have to close the unresponsive tab and open a new one, or wait for 5-10 minutes. I did some research about it and found that Mac Terminal App provides an escape command that can be used to forcefully log out of the remote server. All you need to do is to type the following command in the unresponsive tab.

~.

(Tilda followed by a dot)

I tried it and it works like a charm. It immediately logs you out of the frozen ssh tab and you can reuse your tab again without waiting for it to become responsive again.

Hope this small trick is useful for others as well 🙂

Posted in Unix/Server Stuff | Tagged , , , | 4 Comments