Find and replace text in Linux terminal, bash scripts or Jenkinsfiles

I manage the build process for Android applications. Part of the process automatically updates the version of the application in various build.gradle files. In a Jenkinsfile, a list of file paths are passed into a for-loop in which the find-and-replace sed command is run to set the new version number. Sed for Find-and-Replace Sed is a library used for performing all sorts of text operations, which makes it very handy for scripting related work....

December 1, 2021 · 2 min · Shariq Jamil

Automated image optimization for publishing on a blog

After a few attempts, I have automated the process for optimizing images for JamilGhar. As my wife adds images to the project’s git repository, a bash script that runs on regular intervals will compress them. The end result is fantastic because she no longer has to wait on me to manually optimize them for her and the Raspberry Pi that sits under my desk is being very useful. Why is optimizing images important?...

November 27, 2021 · 4 min · Shariq Jamil

Optimizing images revisited

One of the most important workflows for our food recipe blog (JamilGhar) is image optimization. My wife uploads images to our GitHub repository and, when prodded, I run a bash script that decreases image sizes and removes extraneous information from the files. The script is a constant work in progress and I have a few posts (1,2) about it on here. Lately, I have been considering downloading the repository on a Raspberry Pi and running the script as a scheduled job....

September 27, 2021 · 3 min · Shariq Jamil

Smarter image optimization

This blog has been a nice source of motivation to continue improving my code and development processes. In my previous post, I discussed the process of writing a Bash script to resize and optimize images for publishing to our family’s recipe blog. I mentioned that one improvement I could make is to automate the process of identifying which files needed to be resized. The original script I place large images into the “optimize” directory which are then backed up and processed when I run the following script....

March 31, 2021 · 3 min · Shariq Jamil

Optimizing Images for the Web

When we first started adding photos of food to JamilGhar, we did not think about image size. The average image we posted to the blog was between 2 and 8 megabytes and the resolution was over 3000 x 3000 pixels. The image below is an example. For most blogs, images should be less than 1000 pixels in the longest direction and preferably less than 100 kB. Featured or “hero” images can be up to 500 kB if used sparingly....

March 29, 2021 · 4 min · Shariq Jamil