Counter For Tracking Tickets Using Python

Daily post #13 – I just created a counter using python to track the number of support tickets I do for my company.

This will help me to see a final count by the end of the day. It’ll also show me a timestamp to see when the count was incremented. Here’s the script:

And this is what it it looks like in the output –

I’ve also added a command for exit to end the program. Overall, it’s nothing fancy! But it’s definitely something that’ll help me with my job 🙂

Note: I’m going to Dubai tomorrow for vacation, so I’ll be taking this week off. I will resume my daily posts from 4th of December! 🙂

How To Auto-indent Code In Sublime Text 3?

Daily post #12 – Today’s post is a simple one but again it’s something which will save you plenty of time. How do you auto-indent code in Sublime Text 3?

Method #1 – You just press command+shift+p and type in reindent. This will give a list of results. Just hit enter as you want to select the first option in there. And that’ll add the correct indentation to your code.

Method #2 – You assign a shortcut to method #1 to cut down the whole process to a single step. For this, you’ll need to add the following code to your key binding in Sublime:

[code]
{"keys": ["alt+shift+f"], "command": "reindent", "args": {"single_line": false}}
[/code]

I use command instead of alt, but it’s totally up to you! I learned these two tips from this StackOverflow page.

That’s all for this post, I hope you find this useful 🙂

Script To Generate Random Hex Color Code

Daily post #11 – I just wrote a piece of code to generate a random hex color code. Here’s what it looks like:

Explanation:

  • Create a box and a button
  • Select those using JS
  • Add event listener to the button
  • Connect it with updateButton function
  • This function will generate hex code and insert it inside the box.

My logic was to generate a random number from 0 to 9.

Clearing DNS Cache In Chrome

Daily post #10 – Sometimes a website will stop loading on your computer but it’ll continue to load on other devices. In this case, you may try clearing your DNS cache and that might do the job!

If you’re running Google Chrome, just type the following in your address bar and hit clear host cache button in there.

chrome://net-internals/#dns

This should clear your DNS and allow you to access all the sites again 🙂

What Is $0 In Google Chrome Developer Tools?

Daily post #9 – If you right click on this page and click inspect element, you’ll notice a $0 symbol next to the element which is currently selected. Here’s a screenshot for reference –

So what is it and what it really does? I haven’t explored it enough but based on what I learned it helps us as a reference point. To understand what this means, you have to click on the console tab in developer tools (or simply press CMD+OPT+J on Mac).

Once you’re in the browser/javascript console, type in $0 and hit enter. This is what you’ll see –

That’s pretty much what it does! (afaik at this point) 🙂