Making Boring Work Great Again; or, How I Improved - Not Despite - But Because of Being Lazy

by macmaniac

I admit: I'm a lazy person.

A couple of years ago, I got a job at the company I still work for, back then as a content editor for the company's website, now as a content and test manager.

I got hired to manually check website content that had automatically been migrated but needed to be reviewed.  A lot of dull work.  Most teammates came from marketing or campaigning.  But one guy had this hacker spirit.  As he was not reliable, his contract didn't get renewed.  What a pity.  But this guy showed me a thing that made my job much more interesting and made me dive into programming again: bookmarklets.

Bookmarklets

Bookmarklets are just simple scripts written in JavaScript saved as a bookmark in your browser.

So you can create a bookmark:

javascript:window.location='https://www.2600.com'

as a bookmark.

Clicking the bookmarklet will execute JavaScript code that changes the current windows URL to www.2600.com.

A lot of our work consisted of structuring text and set headers.

In our web-based Content Management System (CMS), you set a Header1 by clicking the "h1" button, then you put a Header2, another Header2, and so on.  Boring.

So I created a script that would click the according button for me and saved it as a bookmarklet.

"Well nice," you might think, "but you still have to click that bookmarklet."

Now here comes the clue: back then, with a shortcut I don't remember exactly, you could access the bookmarklets in your browser's bookmark bar.

Let's say Ctrl-1 invoked the first bookmarklet, Ctrl-2 the second, and so on.

Now I could lean back while going through the text: navigating with the arrow keys to the desired line, and hitting Ctrl-1 to set a Header1, Ctrl-2 for Header2.

No mouse needed anymore.  No more moving the pointer to the tiny "h1" button and clicking it.  I was way faster with this.

The CMS we used got a complete (shitty) redesign, and only little shortcuts were defined.

So I wrote more scripts to enhance the system.  I lost overview, I couldn't remember whether I had to hit Ctrl-7 or Ctrl-9.

Time for an extension.  I found "Shortkeys"1 for Chromium-based browsers, which even lets you define shortcuts for JavaScript-scripts.

Now I'm using AutoControl Shortcut Manager as a free powerful alternative2.

Bookmarklets were yesterday.

So by now, I have - among others - scripts that let me switch between different modes our CMS offers, like preview or edit mode.  Or switching from our test environment to our productive system.  Just by simply hitting a key.  Those two scripts are now in daily use by my coworkers, too.

A Step Further

Now I was on fire.

Instead of the one liners, I started creating "real" scripts to automate some boring tasks.

One of my tasks was to update a link list regularly.

Around 50 links in four languages!  Did I mention I'm lazy?  And I dislike boring tasks from the bottom of my heart.  So I started coding and created a script that would check if the given links were already in the list.  If not, a new field would be created and the link entered.

It took me hours and days to make the script work.  Maybe the same amount of time I would have spent in one year amending the link list.  But, like this, I avoided dull work, learned a lot, and had fun!

As I had to test and thus complete forms every now and then, my next project was a script to auto-complete the forms with the required values.  Being more skilled, the script was set up very fast - it saves me a lot of my time.

For both of these scripts, I used the browsers' built-in developer tools (which you can access by hitting F12) to run and debug my scripts live on the web page.

Those tools are great; they let you check any aspect of a website, like Cascading Style Sheets (CSS), headers, files, and many more.  But maybe I will cover this topic in another article.

More Than JavaScript

Up to this point, I only wrote scripts in JavaScript to manipulate websites.

This taught me a lot: programming basics like variables, loops, objects, to just name a few.

My knowledge of HTML and CSS also improved a lot, as I had to address the buttons in our CMS via CSS selectors.

Now the thing was: website editing was not the only boring thing in my work.  We work a lot with files that have to be checked for one thing or another.

Two factors made me move away from JavaScript to fulfill these tasks with a program.

First thing was: for now, I just manipulated things on a website.  Now I wanted to check files on my hard drive.  I wasn't sure if JavaScript would be the pro's choice.

Second one was: I didn't want to create a front end for my script.  Just a console would be enough.  I'd heard about PowerShell.  Nothing too good, but better than nothing.

I mentioned the files, right?

So some of these files were briefings for website content.  They came from our clients, went to our editors, and finally got into translation.

The file names had to contain the task number and a keyword, and no special characters.  I have no idea how, but the clients managed to mess up every single file's name.  I checked the web for a tool suiting my needs, but no success.

Encouraged by my previous achievements, I dared putting hands on PowerShell.

My impression back then was that it was quite different than JavaScript or Python, but had similarities with Bash.  The script was pretty straightforward: select the folder containing the files, include only .DOC and .DOCX types, add number and keyword, replace a certain special character with characters.

We also had a list with what we call "shortlink."

This CSV file contained aliases to redirect on certain URLs of our website:

/redirect;https://www.example.com/foo/bar.html

This list was edited manually and uploaded to our CMS.

Already one year after having migrated the whole website, that list was messed up again: it contained duplicates and a lot of dead links.

While finding duplicates was rather easy using a spreadsheet tool, finding dead links was impossible.  Would you click through literally thousands of entries to find dead links?  Maybe you're not as lazy as I am.

I let my script iterate through every line, checking server status of given links and writing those with 404 to a file.

But this already was my last script with PowerShell.  As soon as I had a reason why I should be granted local admin rights on my machine, I switched to Python - of which I already had a little knowledge.

I wrote the tool I call "shortlink checker" again in Python.  At the moment, I'm about to implement a feature to write the original file with duplicates and dead links removed while backing up the original file.

Never ever mess with your company's data without having the possibility of getting it back!  I'm even thinking of creating some GUI for that tool.

I'm not the one telling everybody, and especially the boss, how good I am and what I did.

But every now and then, I presented my work to some teammate if I felt like she or he would use it.  Thus, I really got my first official programming task!

It was nothing big, a name had to be drawn at random from - guess what - a list.  Again, I learned new things: how to use random integers?  Are those really random (I couldn't risk my script would draw the same name twice)?  How would I bring the Python script to my teammates with no Python installed?  And how could I create a file selection dialogue?  I managed to resolve all of these issues.  And even included an Easter egg.

I proceeded always like this: a problem occurred, and I tried to solve it with what I had.

Now, having different means and being more skilled, I was looking for other daily business tasks where my coding abilities might come in handy.  I remembered this record and playback browser extension for test automation.  I wasn't convinced, but knew that I could write test scripts in Python with Selenium WebDriver - and so I did.

My newly gained knowledge of test automation came in handy when I was nominated as our team's test manager.

Conclusion

Now, I didn't write this article to show my skills or to share my code.  My scripts are very specific, and my skills are far from what I would like them to be.  But I wanted to show you how I benefited from what I did and encourage you to try as well.

First: I'm still lazy.

This was actually the starting point, and I'll keep my laziness.  It's not that I don't want to do anything.  It's more that I want to do stuff that needs brains and avoid spending my precious time on dull, repetitive tasks, as stated before.  I still do tasks like this, but they don't take a lot of time now as I managed to automate them.

So my job is not that boring anymore, even if I still have these tasks that need to be taken care of.  A less boring job also means more fun.  Preparing a script, adding parameters, letting the script run, and getting the job done feels so good.  It even feels better if you know you just did the work of half a day in a few minutes.  I also always liked to tell my coworkers to let me do their tasks, only to tell them five minutes later with a smile on my face that I'm already done.

During the last few years, I learned a lot and improved my coding skills.

I'm still far away from calling myself a coder, but I manage to do simple tasks.  My self-confidence grew with every working script, with every problem solved, with every programming language I mastered (on a very basic level though).

I learned about programming in general, about the differences and the similarities of programming languages.  I forgot about things and had to learn them again - but not quite from the beginning.  As frustrating as it might be sometimes to find the logical error in a script, anyone having ever coded knows how satisfying it is if you suddenly recognize your fault, correct it, and see the script run without any flaws.  If learning is not fun, having learned definitively is.

I'm not the guy running around and telling everyone about how good I am and what scripts I produced.  But still, I would share my work to make others' work less boring, too.

So my scripts are on GitLab, and the links can be found in my team's documentation.  Whenever a teammate is complaining about a boring task I have a solution for, or guys coming to me asking for that snippet they had on their old computer, I'm happy to provide them with the link to the documentation.  And discreetly point them to the other scripts that might be of interest.  Like that, you're not becoming the smart ass, but the guy who might find or even already has found a solution.

Now you know people are chatty.

So one or another will let your boss know about your skills.  And if your boss knows you're skilled, your career might benefit.  This happened to me in some way.  I got more interesting tasks and finally got a permanent position.  I got my first official programming task, which still excitesme as I think about it.  And I'm also strongly convinced that my path finally led me to the position as a team tester.

I want to encourage all of you to learn, to find ways making your job more exciting, to find creative solutions.

Also, share your knowledge with your teammates - but without being a smart ass.

These tips are not only applicable on behalf of coding, but learning, sharing, and having fun are always good things in any job.

Try it out!

Good luck.

Thanks to cccbe, markus, pierre, steve, tobi, travelline, and yves.

  1. Shortkeys (Custom Keyboard Shortcuts)
  2. AutoControl: Keyboard Shortcut, Mouse Gesture
Return to $2600 Index