DGPLUG, more than a summer training

So, DGPLUG(Durgapur Linux Users Group) is a group where they provide free training to people who wanted to start contributing to FOSS. It is not only a group of Durgapur but it is a now international group. In this blog I am not going to tell you about how and what they teach in their summer training because I haven’t take their summer training yet this yearn I am going to take that but I am going to tell you something more than that like how a community helps to push you to the next level. Their motto is “শেখ এবং শেখাও” it’s a Bengali word meaning is “Learn and teach”.

So, on a regular Sunday I was checking Quora answers and suddenly one of Sayan’s answer written that he had started his journey of open source from DGPLUG and I pinged him on messenger that what is this DGPLUG. He said it is a Linux users group of Durgapur and they provide a summer training every year and you can join it on #dgplug on freenode. On the next day I joined the group and there was going some upstream project discussion and I was quite hesitated to say something and I privately messaged Kushal Das who is the founder of this group. I gave my introduction like who I am and which project I am contributing. He welcomed me and said you should tell this in the group so that everyone can know you. Then I started conversation with a “Hi” and gave my introduction and suddenly some folks welcomed me in this group and I was amazed that how this DGPLUG community is so good and welcoming to a new person and after that I never hesitated to ask any question in this group.

But it is not enough there is a lot more than that, after couple of weeks I made some good friends over there like Kushal, Nabarun, Sourabh and one who regularly comment on my blogs Jason. After that when I stuck any problem I ask their and I know their is somebody at least who is going to help to solve that problem. And now the most important thing what I have learnt from this group is “How to build better network”, “Not to private messaged anyone”, “Read everyday to increase your knowledge”, “Write what you have learnt”.

Thank you 🙂

It is not ok to quit

So, If you face any problem in your day to day life you always have two option either you can quit or you can stick to that problem untill and unless you solve it. Today I am going to tell you about one thing from that I have learned something. So, I am always eager to learn new technologis and I was planning to start learning Ansible from past couple of days.

Let me give you a overviw aout Ansible. It is a IT automation tool to manage our systems and it uses a very simple language called YAML. In this blog I am not going to tell you about Ansible briefly if you want to learn it here is the right place for you.

So, as like all of us when you start learning something you face lots of problem even in the very basic thing. After I started learning Ansible from their official docs I added some IP in the /etc/ansible/hosts file but when I am executing this command ansible all -m ping it is giving me some weired errors that I was not able to figure out what it is and after that I searched a lot in the internet and found the exact solution. After that I again stuck somewhere and this time I was not able to find the relevent solution in the internet and decided to ask in the DGPLUG(it is Linux Users Group og Durgapur where we all hang around and share our knowledge) and a member named Nabarun Pal helped me. We discussed about the error for over 1 hour and after all of that I understand the concept and successfully implemented it. And after overcomming all kind of errors I today I have succesfully wrote my first ansible playbook. Here below the code.

---
- hosts: webservers
  gather_facts: yes
  become_user: root
  tasks:
  - name: Install tree
    apt: pkg=tree state=present
    notify:
    - restart tree
  handlers:
    - name: restart tree
      service: name=tree state=restarted

- hosts: dbservers
  become_user: root
  tasks:
  - name: Install mysql
    apt: pkg=mysql-server state=present

Above the code does very simple thing that it install tree package in my webserver host and install mysql in my dbserver host but I am very happy to see it because I havn’t quit in between my journey and completed what I decided to do.

Thank you. 🙂

Exploring web scraping with requests and bs4

Photo by Rahul Nayak on medium

From the begining of my programming days I am a python guy and also like to find new ways to solve a problem. I also like to do fun stuff with python like playing with different libraries of python like pandas and numpy and so on. Somewhere in the youtube I saw about webscraping with python and found that requests and bs4 library is widely use for this work. So as a regular python guy I installed those libraries with the help of pip and start looking into their documentation for getting start.

So, let me tell you about what exactly web scraping is. It is a programming technique by which we retrieve some website data to do some meaningful stuff. Here first we request the webpage and then we parse the data we get and then we retrieve the data that we want. Here below some code that I have written for fun 😛

In this code i have retrieve all the repositories names from my github profile.

import requests
import bs4

def web_scrapping(webUrl):
    res = requests.get(webUrl)
    soup = bs4.BeautifulSoup(res.text, 'html.parser')

    for i in soup.select('.d-inline-block > h3 > a'):
        print(i.text)

web_scrapping('https://github.com/aniruddha2000?tab=repositories')

In this case I have retrieve the laptops name and their short description from the flipkart 😀

def web_scrapping_flipkart(webUrl):
    res = requests.get(webUrl)
    soup = bs4.BeautifulSoup(res.text, 'html.parser')
    for link1 in soup.find_all('div', {'class': '_3wU53n'}):
        print(link1.text)

web_scrapping_flipkart('https://www.flipkart.com/search?q=laptop')

Thank you. 🙂

Learning the essence of docker

For since laste 2 months i have been learning docker for my mozilla project. And after some time I have acquired some knowledge of docker like how to import a docker image in the Dockerfile and how to create the services in the docker-compose.yml. But didn’t find the essence of it so i was thinking a reallife example where I can implement the docker and understand how it works better that normal virtual environment.

Photo by frank mckenna on Unsplash

Although my mozilla project is having python2 as their base interpreter and all we know the python2 will not be maintained after 2020. So, we need to add the python3 as base interpreter for pontoon python3 beta release. So I took the responsibility to add the python3 interpreter in the base image. So, I took the issue and started working on it and in this issue my co-workers are Jarek, Alex and Adrian. They guided me for this issue and gave enough resources that can help me to understand and implement what is needed. And after interacting with docker I have understand how it works with different images, and how services works with images.

Syncing a fork with upstream

I am writing this blog because at first most of the newbie open source contributor face this problem while working on the second issue after successfully solve the first issue. Let me tell you my story when I first solved my issue of the pontoon project and took the second issue for solving. I eventually solved the second issue and open a PR for that and saw that my PR contains the code which I changed for the first issue. But I couldn’t figure out what wrong with it. So I asked my project mentor what is the problem and he told me that I haven’t updated my fork with the upstream. So let’s come to the point how to do it 😉

  • Open terminal.
  • Go to your project directory.
  • And execute this –
    $ git remote -v
    > origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
    > origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
  • Specify a new remote upstream repository that will be synced with the fork.
    $ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
  • Verify the new upstream repository you’ve specified for your fork.
    $ git remote -v
    > origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
    > origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
    > upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
    > upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)

Now you have set up the upstream with the project GitHub link and you have to fetch all the latest data from that upstream project and push to your fork repo. Now let’s see how it works 😉

  • Fetch the branches and their respective commits from the upstream repository. Commits to master will be stored in a local branch, upstream/master.
    $ git fetch upstream > remote: Counting objects: 75, done. > remote: Compressing objects: 100% (53/53), done. > remote: Total 62 (delta 27), reused 44 (delta 9) > Unpacking objects: 100% (62/62), done. > From https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY >  * [new branch]      master     -> upstream/master
  • Check out your fork’s local master branch.
    $ git checkout master > Switched to branch 'master'
  • Merge the changes from upstream/master into your local master branch. This brings your fork’s master branch into sync with the upstream repository, without losing your local changes.
    $ git merge upstream/master
    > Updating a422352..5fdff0f
    > Fast-forward
    >  README                    |    9 -------
    >  README.md                 |    7 ++++++
    >  2 files changed, 7 insertions(+), 9 deletions(-)
    >  delete mode 100644 README
    >  create mode 100644 README.md

How I started my journey as a open source contributor

So finally after going through all this, it’s time to pen down my journey through this blog.


Being a second-year diploma electronics student at GURU NANAK INSTITUTE OF TECHNOLOGY. In spite of being an electronics student, I have always been fascinated by computers and programming and then I started learning the Python programming language from the beginning of my 2nd semester. After that, i learned the Django framework and developed a couple of web apps by it, and throughout the journey, a guy called Rishi Mukherjee helped me a lot.

After some time I felt that I need to enhance my knowledge so that I can stand out from the crowd. So somewhere from the internet, I got to know about open source contribution where a person can contribute to a real-world project but I did not have much knowledge about what Open Source was and how everything functioned there. So I kept searching on Quora about open source contribution and found this answer, and got to know about this guy called Sayan Chowdhury. So I pinged him on Instagram and told him that I need some help about open source contribution. After that our discussion kept going on the messenger. On that point in time, my biggest problem was to find a good upstream python project to contribute. And he really helped me a lot in this case, he gave me a list of Mozilla project so that I choose one, and finally found pontoon a good upstream project to contribute.

After choosing a project I joined their IRC and my first goal was to create a local instance of the project, and for that part, I haven’t faced any problem because the project uses Docker and it is really easy to build a local instance of the project. And after a lot of discussion on the IRC with the mentors, I picked a bug and started working on it. And the day I made my first successful contribution to Pontoon. I made my first open source contribution on January 9, 2019.And after that no looking back, I contributed to this project for over 4 months.