How to set off an Alarm on Macbook when the battery is full?

If you’re one of those people who keep their laptop on charging and get busy doing other stuff IRL then you’ll like this post.

In this post, I’ll be sharing a tip which will help you set off an alarm on your Macbook as soon as the battery is full.

The idea here is to add a command to the Crontab file. Crontab is basically a list of commands that you want to run on a regular schedule.

To add a command to Crontab, open the terminal, type the following command and press enter.

crontab -e

Press ‘i’ key on the keyboard to edit the file and enter this command in the file –

*/1 * * * * python /Users/USERNAME/

The number 1 in the command above represents an interval of 1 minute. So the python script located in that respective directory will be run every 1 minute.

Exit the edit mode by pressing the escape key. Save the file by pressing SHIFT+Z twice.

Now create a python file called with the following script. Also, make sure to keep it in the right directory which you mentioned before in the crontab.

 import subprocess
import webbrowser

battery_info = 'pmset -g batt'
battery_info_output = subprocess.check_output(battery_info, shell=True)

if "charged" in battery_info_output:"file:///Users/omkarbhagat/scripts/play.mp3")

And also make sure to change the last line to locate a music file on your computer.

That’s all. With this setup, the script will run every 1 minute and the music file will run once the battery is full. 🙂

How to connect to a Wireless Printer?

I have HP Deskjet 2540 printer. It’s a wireless printer. And when I got this one, I had no idea about how to configure a wireless printer.

I guess most people will have no idea about it like I didn’t. So I’ll write this post to make it easy for people looking for answers.

Before I start, note that I’m not an expert on Wireless printers, I’ve no idea about every kind of wireless printer. But I’m pretty sure this tutorial will work for most wireless printers out there. So let’s start!

Most of the wireless printing happens by connecting your printer and your computer to the same WiFi network. So the only thing you actually need to do is connect your printer to the WiFi network.

To connect your printer to the WiFi network, you’d need to configure your printer by selecting the network and entering the WiFi password. But you can’t do that if your printer doesn’t have a keypad, right?

So you’ll need a cable to connect your computer to the printer and then you’d be able to configure it. Plus you’d need the right software (usually found on the printer’s website). For my printer, I use something called HP Utilities.

Long story short (TL;DR)

Connect your printer to your computer using a cable. Download the drivers/utility software. Open it and configure your printer to connect to the WiFi network. Once that’s done, just go ahead and print a test page.

The only part which sucks about this whole thing is that you ‘need’ a wire (cable) before you can go wireless!

Unlock iPhone without having to press the Home button (iOS 10 update)

I just installed the latest iOS 10 update on my iPhone. It’s pretty cool except for one thing. I have to press the home button to unlock my iPhone.

I hate it. I know my friends hate it. And I’d like to disable that feature and go back to how things were before this ‘iOS 10 update’.

If you feel the same, this is how you can unlock your iPhone by just resting your finger on the home button (as you used to do before this update) –

Go to Settings > General > Accessibility > Home > Toggle ‘Rest Finger to Open’ option!

And you’re back to unlocking the phone without having to press the home button. Enjoy 🙂

How to transfer music to iPhone via iTunes?

Transferring music to iPhone can be confusing if you’re coming from Android or Windows. But it’s not that hard if you get the basics clear.

There are two music libraries which you should keep in mind, one is iTunes music library on your computer and another one is iTunes music library on your iPhone.

  1. iTunes library on Computer – called Songs
  2. iTunes library on Mobile (iPhone) – called Music (Devices > Your iPhone > Music)

Notice the  ‘Songs’ and the ‘Music’ option in this screenshot

The idea (in short) is to connect your iPhone to the computer. Open iTunes. Enable Music Sync for the connected iPhone.

Move (drag/drop) music files in Songs. Click on Sync and done. The music files will appear in Devices > Your iPhone > Music. And of course they’ll also appear in your iPhone.

If that’s confusing, here’s a step by step explanation of the same – Continue reading

How to install WordPress on localhost using XAMPP?

This is the WordPress beginner stuff that every WP developer must know. You can say this is probably the very first step in the journey of WordPress development.

Because once you know how to run WordPress on localhost (on your computer), you can do all the customization that you want to do. You can develop themes, plugins, etc. You will basically get access to edit each and every file in the WordPress directory.

Note that this tutorial is for Mac OS X users. If you’re on Windows, you should search for “How to install WordPress on Windows?”

  1. Download XAMPP
  2. Download WordPress and extract it (wordpress folder appears)
  3. Install XAMPP
  4. Copy (CMD+C) wordpress folder
  5. Open Finder > Click on Go Menu > Applications > XAMPP > htdocs
  6. Paste (CMD+OPT+V) WordPress folder in htdocs
  7. Run XAMPP (Applications > XAMPP > manager-osx)
  8. Click on Manager Servers tab and hit start all
  9. A dialog box appears – do you want to accept incoming connections? Click on allow
  10. Open web browser and type localhost/wordpress in the address bar
  11. Hit enter
  12. WordPress installation screen appears 🙂

Once you complete WP installation, you will be directed to the front page of the site. That’s how you get WP running on localhost! 🙂

WordPress installation documentation can be found here. And if you run into permission issues on Mac OS X, then this post can help you! 😀

How to delete all the Emails from Gmail’s promotions tab

I wanted to delete all the emails from Gmail’s promotions tab and I was doing it wrong the whole time. And no, I wasn’t deleting my emails one by one! 😛

You know the Gmail page by default shows a list of 50 emails. And it says 1-50 of X are shown on the current page. You can navigate between pages to see a list of 50-100 emails and so on.

I used to select all the emails on one page and delete them. Then I’d select all the emails on the second page and delete them. That’s fine if you’ve like 100-200 emails. But if you have to delete thousands of them then it becomes monotonous.

Then I discovered that it’s actually possible to delete all the emails in a particular tab instead of deleting them page by page.

All you have to do is select all the emails in a particular tab (like the promotions tab). Then you’ll see something like this appears on screen –

All 50 conversations on this page are selected. Select all 83 conversations in Promotions

Now you have to click on “select all” and all the conversations will get selected in that respective tab. And then, of course, you can delete them! 🙂

One small tip for Beginner Bloggers – Content is the King

I started blogging in 2011 I guess. My first blog (or first few blogs) were on Blogspot and WordPress (free plans obviously). Then I moved to a self-hosted blog (paid hosting) in July 2012. I made plenty of mistakes there and learned from them. In this post, I’ll share my one mistake. 🙂

When I made my first blog on Blogspot, I was curious and excited to customize it, change the layout, add a facebook likebox, etc. I did all of those things and learned a lot about XML, HTML, CSS, and JS.

But this is not “why” I started blogging in the first place. I was learning and exploring things which would help me make my blog look better.

And my obsession with the blog’s look and feel made me switch to a self-hosted WordPress blog. On the self-hosted site, I could customize “everything”.

Again, I focussed too much on the design and made it look better, I made it load faster and I optimized it for search engines by reading up some SEO tips and tricks.

But I never started blogging to do any of this! If I look back and think about it, I spent a lot less time writing blogs, but I spent way too much time, energy and effort to customize it.

Now I know exactly why I started blogging – Back in 2009, I used to help people on Orkut to fix their computer issues. But when this task became repetitive (like 10 people asking help for the same issue), I started writing my solution in notes (or community, I don’t remember what it was called..but you get the point!).

At some point, someone asked me to start writing a blog. And that’s how I started blogging. But I lost the way and dug way too deep into web development stuff and started customizing things.

I don’t regret doing that because it helped me acquire new skills. But I should’ve also focussed on the writing part. So I’d like to conclude the post with this one line –

When it comes to blogging, Content is the King.

Now I’ve moved back from my self-hosted blog to this one, which is hosted on (free plan). Why did I do that? I’ll save that topic for the next post. 🙂

Google Analytics – Using RegEx to find a word starting with and ending with

I was working on creating a new segment in Google Analytics with the following conditions –

  1. The event name should start with “Scroll Tab”
  2. And the event name should end with “Run”

To create such complex conditions, we need to make use of Regular Expressions (RegEx) in Google Analytics.

In this case, I make use of three symbols –

  1. ^ which means “begins with”
  2. $ which means “ends with”
  3. And .* which means everything in between the start and the end

So if I have to find events starting with “Scroll Tab”, ending with “Run” and anything in between then this is the RegEx that I can use –


I learned about these RegEx symbols from this awesome blog post. 🙂

Volume too low on YouTube videos? Here’s how to fix that!

Have you ever come across a YouTube video with poor audio levels? Well, I’ve been there!

I’ve found the best tutorials on YouTube but some of them are really hard to follow because of the bad audio levels.

You know it’s really bad when the video is inaudible even after setting the computer’s volume and youtube player’s volume to 100%.

In this case, there’s one way to fix it. And this fix is under the assumption that you’ve installed VLC player in your computer.

  1. Open the YouTube video in your browser
  2. Copy the URL of this video
  3. Open VLC player
  4. Click on File > Open Network
  5. Paste the URL
  6. Click on Open

And that’s it, you’re now running a YouTube video in the VLC player!

If you’re wondering – “How does this solve the audio issue?” then all you need to do is increase the volume in the VLC player. This works well because VLC allows the volume to go above 100%. I keep it somewhere between 100 to 150. Just saying!

I hope this works for you and thanks for reading 🙂