Hiding Stuff Quickly Using CSS

Daily post #6 – I’m late to write my daily post so I’m going to write a short tip (but a useful one) for this one. This is about how to hide something quickly on your site using CSS.

There’s a CSS property called display whose value can be set toΒ none for any HTML element that you wish to hide. Here’s how:


Visit your site in Chrome, right click on the point which you wish to hide and select inspect element. Find the class or id and then make use of the code given above.

And it’ll magically hide the element from the page! πŸ™‚

Changing Text Using Button With JavaScript

Daily post #5 – Hey there, today I’ll be writing about changing some text on the web page when a button is pressed. All of this done using JavaScript of course!

And it does this:

Very cool, right? Just a button changing some text using JS! Nothing great but pretty Awesome πŸ™‚


We first made JS understand that btn is the button which we click and txt is the paragraph tag containing some text which should change when the button is clicked.

We then added an EventListener to btn so we know as soon as it gets clicked. And that triggers the code inside the function.

That code checks if txt is Awesome, make it Not Awesome and vice versa! That’s all πŸ™‚

Printing File Names In Folder Using Python

Daily post #4 – Today I’m going to share how you can use Python code to fetch file names inside a specified directory.

import os

indir = '/users/omkarbhagat/desktop/batman/'
for root, dirs, filenames in os.walk(indir):
	for x in filenames:
		x = "/users/omkarbhagat/desktop/batman/"+x

Note that the python code above only works with correct indentation so if something breaks, make sure to have correct indentation. Also make sure to have all spaces or all tabs in the code, don’t mix them up!

I had the following setup – A folder called batman on my desktop with couple of txt files inside it. Running the above code returns the following result –

Omkars-MacBook-Pro-3:desktop omkarbhagat$ python test.py

Once I have a file name or directory in a variable, I can do stuff with it. For example, I can change all file names, or edit the content of all these files by a conditional statement or something. I’ll probably share that in a separate post. That’s all for today, thanks for reading! πŸ™‚

Login Using SSH Private Key

Daily post #3 – Today I’ll share how to login to a server using SSH and a private key πŸ™‚

#1. Save Your Private Key

The very first thing is to save your private key in a text file. It could be in .txt or .pem format.

Next, open terminal, navigate to the folder which contains your private key and change it’s permissions by typing in the following command:

chmod 600 filename.txt

#2. Prepare Credentials

Before you login, you’ll need these SSH credentials:

  • hostname
  • username
  • port (default SSH/SFTP port is 22)

#3. Login Via SSH

Once you have the credentials, just open the terminal, navigate to the folder containing your private key file and type the following command:

ssh -i filename.txt username@host -p port

You of course have to replace filename, username, host and port in that command with your respective server credentials.

If it returns a “permission denied” error, you’ll have to make sure you changed your private key’s permissions (check step #1).

#4. Other useful commands

Once you’re connected. You can make use of the following commands:

  • pwd (present working directory) – does pretty much what it says!
  • ls -al – shows a list of files and folders with their permissions
  • rm myFile.txt – delete a file
  • rm my*.txt – delete files starting with my and ending with .txt
  • rm -rfΒ myfolder – delete a folder

That’s all in this post! Next post, tomorrow!

Change Text Using JS querySelector

This is my 2nd post for the daily-post project. Today I learned a bit about querySelector in JS. I suggest you copy paste the following code in your Sublime Text and save it as your-desired-filename.html on desktop or your sandbox folder.

This is such a simple trick to turn your static page into a dynamic one!

  1. We basically write `I love Batman` text inside the paragraph tag p.
  2. Then use the querySelector to select the first occurrence of p tag in the source code.
  3. Save that as reference in variable t.
  4. Add an event listener to it which will trigger myFunction when clicked
  5. myFunction will prompt us to enter a name and then modify the content inside the variable t.

That’s all. Simple but useful. Expect more JS in my future posts πŸ™‚

How To Remove PPPoE Icon From The Menubar In Mac

I had configured PPPoE on my network at some point and this made my OS display an icon on the top right corner in the menu bar. I tried to find a way to remove it but nothing worked.

Then I finally found this simple solution on StackOverflow! It said, I can simply press CMD key and drag the icon out of the menu bar. This worked! You can also use this trick to rearrange the icons in the menubar!

This didn’t require a tutorial I know but I’m sharing this on my blog because I plan to write a post on a daily basis. I may not get time to write lengthy or super detailed posts but I will try to squeeze out a post everyday.

I guess short posts will help to achieve this! That’s my plan! Let’s see how it goes! πŸ™‚