Tell-me-more

I am pretty sure that you are wondering why such a title!

Tell-me-more is a command line tool built using Python3 that provides information about the linux user and the system. The tool displays the users of the system, the current user who is logged in the system, and the memory information.

To run the tool follow README .

I have used regex-regular expression in Python3 for pattern searching. I have taken help of re module for pattern searching, argparse module for taking command line argument.

Check the source code in github to stay updated.

Finds the users


def bash_users():
    with open('/etc/passwd', 'r') as fobj:
        f = fobj.readlines()
        pattern = '/bash'

        for i in f:
            m = re.search(pattern, i) #searches if the given pattern is in i
            if m:
                print("%s" % i.split(':')[4])
            else:
                pass


Finds details of the memory of your system



def memory_details():
    with open('/proc/meminfo', 'r') as fobj:
        f = fobj.readlines()
        pattern = '^Mem' #All the strings starting with Mem

        for i in f:
            m = re.search(pattern, i) #searches if the pattern is in i
            if m:
                print("%s: %d MB" % (i.split(':')[0], int(i.split()[1])/1024))  #Displays the memory in unit MB
            else:
                pass

See howitworks for a demo of Tell-me-more. Fork me on github to contribute for this project. Thank you 🙂

Calci

I have built Calci, a command line calculator for linux that performs basic operations like addition, subtraction, division and multiplication. I have used Python3 to build this command line tool. You will find that I had already made a blog post on Command line calculator earlier. Now this new post comes with some edits of the earlier one and another important thing is that I have made this open source .

To run Calci follow the steps given below:

  • git clone https://github.com/trishnaguha/Calci.git
  • python3 main.py followed by arguments

Since it is a command line tool you’ll need to provide arguments after python3 main.py . Type python3 main.py -h or python3 main.py –help to know this in details.

you can also fork Calci on github and send pull requests to add extra features or edit the existing features. You are also invited to open issue if you find any.

I am really excited about this project, Looking forward to turn this into a scientific one. 🙂

Finish what you started, don’t give up

“Finish what you started, don’t give up” one of the most important motto of Open Source Project. This is not applied for just only Open Source but also for everything.

I have learnt something great from sanketdg in dgplug, can be termed as life lesson, i.e, “Completing the task that I have started or committed at any cost with out giving it up. “

I sent a pull request to pym in GitHub on some typo. On Wednesday kushal suddenly told to me to resolve conflict of the pull request that I have sent. My branch was having conflict , that’s why kushal was not able to merge the pull request with his master branch. And it took almost three hours to resolve the conflict.

Actually what I did was I fetched the upstream from git and rebased it  with my master branch. But the branch from where I sent the pr I forgot to it sync with master branch, thus my branch was totally messed up. sanketdg who knows git very well went on telling me the steps to resolve the problem. Two hours passed, still the conflict was not resolved. I told him that I better close the pr that I have made and open a new one. He told “nah. we better resolve this”. Every time I told sanketdg the same, he replied me the same. And finally with his help I solved the conflict. I learnt that it is necessary to always rebase your local branches with the master branch changes.

This is what we face in real time problems. There is no way to move away when you are having an issue/problem, we will have to solve it at any cost. In the same way we,who are now practicing can’t take a back because of being unable to solve a problem. What we have started, we have to finish it. Giving up is not an option.

Thank you 🙂

Why we should spend more time on IRC

Yes, we should spend more time on IRC. Folks share their knowledge there. They come up with their doubts and problems; and I go with mine even if it is not the session time. So there is always a session no matter it’s a formal one or informal one. It’s actually about learning from each other at each and every time.

Well coming to my point, finally there was a midnight informal session from dgplug like they used to do some years before.

We usually have session at 18:30 IST in dgplug. I opened an pull request with three commits in pymKushal informed me this evening that I have to remove the last commit as it was not a correct one. Being a beginner to github , what I did is delete the changes from the original file in my local pc, commit and push it again to my own repo and open another pull request to pym again . Hence it results another new commit i.e, the fourth one. And I was stuck here. I became pretty confused since I couldn’t remove the third commit which was also followed by a fourth one, where as Kushal has told me to remove the third commit and do a pull request with only first and second commit.

Thus I pinged Kushal in irc and he told Sayan to help me to solve this. It became quite easy to me when Kushal , Sayan and some other folks in dgplug helped me. So what I did


git reset --hard HEAD~2  #Head is now at the second commit, Deletes last two commits
git push origin master -f  #This a forced push, PR is updated automatically

This has removed the last two commits finally!

There after, Sayan took an informal hands on session on github to understand git properly. It was really a useful one. Hence we understood why people should spend more time on IRC. It has been a wonderful midnight session 🙂