My first contribution to Fedora: Getting started

I am now contributing to fedora. I am blogging this since it is my first contribution to fedora. So I am really excited 😛

I have recently fixed an issue of bodhi(python-fedora) of fedora-infra. This is my first bug fix in fedorafedora-infra consists of infrastructure applications, building tools, utilities and creating new applications to make fedora development a smoother process. kushal told us to open a FAS account to contribute for  fedora and provided some links including an easyfix link for beginner. So thanks to kushal and dgplug for making it my first fedora contribution ^_^ . whatcanidoforfedora has lots of options to get started with fedora contribution. The channel #fedora-apps is a perfect channel to get started with fedora-infra contribution.

Looking forward to contribute more to fedora  :).

Keep an eye on mygithub to stay updated with my open source contributions ;).

A step by step guide to Vim text editor with video

We use editor to create and edit files. Vim is one of the most preferable text editors for Linux/Unix system. Vi/ Vim editor is a powerful tool which is customizable, extensible and well documented. We can design the configuration file of Vim as the way we want.

Installation of Vim

$ sudo yum install vim

$ sudo apt-get install vim

$ sudo zypper install vim

Open Vim editor

$ vi

Open/ edit/ create file with Vim editor

$ vim helloworld.txt

Configuration file of vim (This is optional)

Open terminal. Make sure you are in home directory.

$ touch ~/.vimrc      //This creates an empty file

$vim ~/.vimrc         //This is hidden file

Now copy content of vimrc by kushaldas to the ~/.vimrc and save it.

Functions of Vim editor

When you open a file with vim editor

Press i for INSERT mode and edit/ create the content of the file

Press ESC before you use the following options followed by ENTER:

  • :w to save the file.
  • :q to quit the file.
  • :wq or x to save and quit.
  • :q! for force quit.
  • :e! if you don’t want to save and go back to last saved revision.
  • r to replace with new character.
  • A to append.
  • x to cut a character.
  • xw to cut a word.
  • xx to cut a whole line.
  • y to copy.
  • yy to copy a whole line.
  • p to paste.
  • :set nu to set line number.
  • :set nu! to turn off line number.

To read more about vim editor

Open terminal and type

$ vimtutor  


$ man vim

Reference Dgplug summer training vim doc

Click on the image below that will redirect you to the video of vim tutorial.



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 =, i) #searches if the given pattern is in i
            if m:
                print("%s" % i.split(':')[4])

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 =, 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

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

Making of an index page

Continuation of static site generator….

Each and every blog has an index page that contains 5-6 posts of your blog posts, like wordpress has 10 posts in the index page/ Home page by default. I used to wonder how wordpress shows only the last 10 of my posts in its index page. And yes finally I’ve figured out the way 😉 . We are working on static site generator/ static blog generator in dgplug for the last 10 days and on the last Wednesday kushal shoot an assignment of making an index page to us. His question was a bit confusing, all the folks of dgplug were really confused. Because we were not thinking what kushal was thinking, so he decided to elaborate more on this Monday.

But I couldn’t wait for 3-4 days to solve the assignment, thus guessing what kushal was thinking I finally did something and kushal finally said that it matched with at least what he thought. kushal guided me with what else I have to include in the script and I followed him. Hence I was almost done with the index page of static site generator. Let me share with you what I have done 🙂

from markdown2 import Markdown
import os

def index_page(source_path, destination, N):
    files = []
    for f in os.listdir(source_path):
        if f.endswith('.md'):
    return files
    with open(destination, 'w') as d:
        for source in files[:N]:
            with open(source, 'r') as s:
                smd =
            markdowner = Markdown()
            dest = markdowner.convert(smd)

index_page('source_dir_path', 'index.html', 2)

This script searches for all the .md / markdown files in the source directory and makes a list of it. Then converts it to html as needed. According to this script the index page is having 2 posts.

Thanks for your time :). Can’t wait to contribute a project on static site generator in my github.

A Step towards Static-Site-Generator

It was a bright evening and the time was 18:30 IST , Kushal told “Let us write a bigger project part by part then,What about a static blog generator?” And I was like feeling like wow I’ll be making a static site generator like Jekyll  by what I was thinking to host my site in github. Though the job is not easy enough because a static site generator can not be made overnight. But I was almost done with an Initial step to static site generator i.e, converting a markdown file to a html file.

Kushal introduced us with markdown2 module of Python3.  Markdown2 belongs to pypi which is the official third-party software repository for Python Programming LanguageMarkdown2 is a text-to-html filter that converts plain text formatting to HTML which fulfills one of the most important features of a static site generator.

To install the package in fedora do sudo yum/dnf install python3-markdown2 

Change the package manager according to your Linux distro .

The first problem given by Kushal was to write a program “Which will read a given markdown file, and generate a HTML file in a given path”.

And this did not take much time to solve

#!/usr/bin/env python3

from markdown2 import Markdown
def generate_post(source, destination):
    with open(source, 'r') as s:
        smd =
    markdowner = Markdown()
    dest = markdowner.convert(smd)

    with open(destination, 'w') as h:

After going through my code Kushal said, “Looks good”. And he shoot an another problem that took longer time to solve. He told to write a program “Which will search for .md (markdown) files in a given directory, and finally convert them into HTML files in another given directory”. Creating the HTML files in another directory was like hammering in my head :/ .

I was almost done with the problem with some parsing issues. SanketDG helped me to solve the errors I was getting, so thanks to him 🙂 .

#!/usr/bin/env python3

from os import path
from markdown2 import Markdown
import os

def generator_post(source, destination):

    with open(source, 'r') as s:
        smd =
    markdowner = Markdown()
    dest = markdowner.convert(smd)

    with open(destination, 'w') as h:

def convert_to_html(md_path,html_path):
    for f in os.listdir(md_path):
        if f.endswith('.md'):
            hname = os.path.splitext(f)[0] + '.html'
            html_path2 = os.path.join(html_path, hname)
            generator_post(os.path.join(md_path, f), html_path2)

if __name__ == '__main__':

Thanks OS module for your awesomeness 😉 . I thinks I should stop writing now 😛 . Keep an eye on github/trishna_g . I’ll be contributing a project on static site generator very soon 😉 .