April Fedora Meetup – Started My Contribution to Fedora

I am a Fedora member since last year (here is wiki page).

To be Frank I don’t know from where I can Start my Contribution to OpenSource. But from yesterday(24th April 2016) I got the right direction to my Contribution. I attended the Fedora Meetup. In Fedora Meetup Kushal Das, Chandan Kumar, Praveen Kumar gave a direction to my Contribution.

In Fedora Meetup, they told us regarding Unit Testing. As we are not much familiar with Unit Testing Kushal gave us a small but useful demonstration on “How system commands are to be tested”. We started as a beginning of the Unit Testing on system command ‘cat’ Following is snippet of the MyFirstCode,

import unittest
from testutils import system
class Firetest(unittest.TestCase):
    def test_cat(self):
        out,err,retcode= system("cat /etc/fedora-release")
        out = out.decode('utf-8')
        self.assertIn('Fedora',out)
if __name__ == '__main__':
    unittest.main()

For above code, he gave us a link to use some class and methods, here is the link. We cloned this repository and started writing Unit Test on ‘cat’.

It is too difficult that many people are working on same system command, so Kushal gives different commands to each of us. We started writing Unit Test on it.

(Interesting thing while doing all the stuff, we had tasty snacks and drinks too 🙂 )

The task assign me is Check the error code status of “sudo su test_satyajit;exit”.  I had written that test case too. Here is a snippet of it.

import unittest
from testutils import system


class Firetest(unittest.TestCase):
 """#docstring for Firetest"unittest.TestCase def __init__(self, arg):

#super(Firetest,unittest.TestCase.__init__()
 #self.arg = arg
 """

def test_cat(self):
 out, err, retcode = system("sudo useradd test_satyajit")
 self.assertEqual(retcode, 0, out)
 out, err, retcode = system("cat /etc/passwd")
 self.assertEqual(retcode, 0, out)
 out = out.decode("utf-8")
 self.assertIn('test_satyajit', out)
 out, err, retcode = system("sudo su test_satyajit; exit")
 self.assertEqual(retcode, 0, out)
 out, err, retcode = system("sudo userdel test_satyajit")
 self.assertEqual(retcode, 0, out)


if __name__ == '__main__':
 unittest.main()

While enjoying with the Unit Testing, I interacted with many fellows and get enhanced my knowledge and also their. Here are some Pics from Meetup…

After all, This meetup was Very Good !!! Once again Thanks to Kushal Das, Chandan Kumar and PraveenKumar for arranging this Meetup.

How to setup Sublime Text editor

About Sublime text editor

Sublime Text is a cross-platform source code editor with a Python application programming interface (API). It natively supports many programming languages and markup languages, and its functionality can be extended by users with plugins

It natively supports many programming languages and markup languages, and its functionality can be extended by users with plugins, typically community-built and maintained under free-software licenses.There are Sublime Text 2 and Sublime Text 3 available. You are free to choose which version you want to use.

For now, I will demonstrate Sublime Text 2

Now step by step we will see How to use  Sublime text editor.

Step 1: You have to download Sublime Text 2 from here… It will download the tarball of Sublime Text 2.

Step 2: Goto Download folder and extract it in /opt

 

$ sudo cd Downloads
$ ls
$ tar -xvf Sublime Text 2.0.2 x64.tar.bz2 -C /opt

The extracted directory contains an executable command for Sublime Text which you have to run from that folder only. For that reason, we will create a symbolic link in /usr/bin. Then we can execute that command from anywhere.

Step 3: Create a Symbolic Link of sublime_text executable

$ cd /opt
$ sudo ln -s /opt/Sublime Text 2/sublime_text /usr/bin/sublime_text
$ sublime_text

More information regarding tar command you will find here…

If this is useful to you then don’t forget to comment and share !!!

How to extract tar.gz or tar.bz2

A tarball or an archive is nothing but a single file that contains various individual files. This blog will help you how to create/extract tarball.

Step 1: How to create tarball

$ tar -cvzf file.tar.gz /location/files/*
note: * means all file, you can specify a single file giving name instead of *.
$ tar -cvf myarchive.tar file1 file2

Step 2: How to extract tarball

tar -xvf myarchive.tar
tar -xvzf file.tar.gz
note: it will extract files in current directory only
Step 3: Extract Tarball to specific directory
tar -xvf myarchive.tar -C  /directory/to_extract
tar -xvzf file.tar.gz -C /directory/to_extract
Description of Options used:
c, –create Create a new archive.
-v, –verbose Operate verbosely.
-f, –file=ARCHIVE   Use archive file (or device) ARCHIVE.
x, –extract, –get Extract files from an archive.
-C, –directory DIR    Change to directory DIR before performing any operations.
-z, –gzip, –gunzip Decompress and extract the contents of the compressed archive created by gzip program (tar.gz extension).
If this is useful to you then Like and give a Comment. Your comments are useful for improvements.

Installing VLC on fedora 21

vlc_blog

Before performing following steps make sure that you not logged in as a root user. VLC does not work fine with root user.

1. You need to setup a repository

There is rpm-fusion repository which available in free and non-free

a. Go to Terminal :

For rpm-fusion-free repo execute:

$sudo dnf install http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm

For rpm-fusion-nonfree repo execute:

$sudo dnf install http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
2. Download required package before installing VLC

Following are required packages for GNOME desktop user

$sudo dnf install gstreamer1-libav gstreamer1-plugins-good gstreamer1-plugins-ugly gstreamer1-plugins-bad-free gstreamer-ffmpeg gstreamer-plugins-good gstreamer-plugins-ugly gstreamer-plugins-bad gstreamer-plugins-bad-free gstreamer-plugins-bad-nonfree
3. Install VLC
$sudo dnf install vlc

If you like this blog Leave comments, share it.