Skip to main content

Posts

Showing posts with the label blogger

Flip a coin million times w/ Python

Photo by ZSun Fu on Unsplash Welcome everyone to my blog. I could not write a new blog post for the last year because of my heavy work schedule. So I thought to write an article on a recent project done by me. Let's get started. Imagine that you want to flip a coin. Perhaps you don't need a complex python script to flip and find a result but what if you're going to flip a coin 2 million times and check the results. Then you have to invite Python to do all the hard work for you. If you are not interested to dive deep, just go ahead and check my project on Github. And also don't forget to follow my profile for the latest fun projects. and if you are a Python expert please feel free to fork.  🍴🍴 Link: https://github.com/chamodhk/coin-flipper Import the libraries you want! If you aren't using a GUI all you have to import is the random module. If you are an expert you don't have to import it too because you can write a function to get the random part done. im...

Divide your blog posts into pages on Blogger in 5 minutes !.

If you are a blogger who uses Blogger as your CMS like me, you must have a question. "How Can I Post On A Separate Page So That Readers Can Easily Find All Posts Related To A Topic??" Then you got to the blogger setting pages and got the pages tab. Then you create a new page with a title and post your first post related to that title. You add pages widget to your blog and think you're all set. But you aren't. You have to face the problem when you are going to post a second post related to the previous topic. You find no way to create a new post inside your page. You try using Iframes or borders blah blah blah... but all of them waste your precious time. But Don't Worry. You are a fan of my blog with 5 minutes to do an experiment and I have the Solution. Here we go... How To Divide Blog Posts Into Pages on Blogger Step 1 When you create new posts on Blogger you can easily add labels to your post   Go to that section and enter labels that related to your post. you c...

Generate all possible phone numbers with Python | Generates Crores of Phone Numbers within minutes.

Recently,  I learned about itertools in python. Especially, about the functions permutations, combinations, and products and I tried to make a script that generates all phone numbers in our country. I bet your phone number is too on the list. let the hack begin!!! First, you need to install itertools in your computer  Simply open your terminal and type                sudo apt-get  install  -y python-more- itertools Then Write the code below from itertools import product file_name = "phonebook.txt" phonebook = open (file_name, 'a' ) prefixes = [ '+9471' ] product_a = product([ '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , '0' ], [ '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , '0' ], [ '1' , '2' , '3' , '4' , '5...

Create a simple Digital Clock for Your website with Javascript.

Create a Unordered list in HTML You have to create a unordered list using <ul> and</ul> tags in your HTML file. And inside it include 3 <li> elements for Hours, Minutes and Seconds . ul > < li id = 'hours' ></ li > < li id = 'minutes' ></ li > < li id = 'seconds' ></ li > </ ul > Write The Script With Javascript Then you can place your script inside head tags. < script > function newfunc () { a = new Date (); day = "AM" hours = a . getHours (); if ( hours > 12 ){ hours = hours - 12 ; day = 'PM' } else { } document . getElementById ( "hours" ). innerHTML = ( "0" + hours ). slice (- 2 )+ ':' ; document . getElementById ( "minutes" ). innerHTML = ( "0" + a . getMinutes ()). sli...