Bash command to check directory recursively and count average line count and average chars per line in files

Bash command: find . -type f | xargs wc -lc | sort -n | awk ‘{prev=curr; curr=$1″ “$3} NR==1{print “Min lines:”, $1, $3} END{print “Max lines:”, prev; print “Total of”, $1, “lines in”, (NR – 1), “files”; print “Avg line count:”, ($1 / (NR – 1)); print “Avg chars per line:”, ($2 / $1)}’; Breakdown …

4 tips for writing documentation – Discoverable, Accessible, Searchable, Handleable (DASH)

Skipping the usual background rant 😛 For me, the purpose of documentation is to save time, not at the point of writing it, but in the future when you use it. When onboarding a new hire or answering a colleague’s questions on my code, I would usually first refer them to the README.md file in …

Renewing SSL certificate on Apache Solr server

References: Enabling SSL for Solr Taking Solr to Production Steps: SSH into the server. Upload the private key for the renewed SSL certificate as well as the updated certificate chain (just the primary certificate for the domain will not do), e.g. STAR_example_com.key and STAR_example_com_fullchain.pem. If you are unsure, check out my earlier article on Things …

Fixing Sectigo/Comodo SSL certificate expiry error on Ubuntu servers and Docker containers

Was alerted this morning to server applications failing due to an expired SSL certificate, with logs showing cURL errors. The weird thing was there was still half a month to go before the expiry date. Also, this problem does not affect browsers as the major browsers have already been updated. Importing the renewed SSL certificate …

Guidelines to protect developer time for meetings and sprints

Just came up with some guidelines which I feel would help in protecting developer time with regards to meetings and sprints, mainly by putting in some kind of structure. Disclaimer: These guidelines may not be applicable to everyone or every company 😛 Do read Paul Graham’s article on Maker’s Schedule, Managers Schedule which clearly explains …

10 criteria to rate oneself in a programming language or framework

Was sitting on an interview panel recently and the interviewee was asked to rate himself for the Laravel PHP framework, on a scale of 1 to 10. Some basic questions on Laravel were asked before this but the answers were not satisfactory. His reply? 9/10. Personally, for PHP, I would probably rate myself 5/10, and …

Responsible CSS – your plugin is only a tenant renting a room in someone’s house

Let’s say you own a website with 2 webpages and you wish to install a third-party plugin to create a newsfeed on each page. In this case, I am the author of the newsfeed plugin that you have chosen. Below is a sample of how the plugin is embedded: <div class=”container”> <!– container element provided …