10 years of DGPLUG

We recently celebrated the 10 glorious years of DGPLUG. On this occasion we had a 5 day workshop (29th August to 2nd September) at NIT Durgapur.

::Day 1::

The first day was more or less introductory session where we discussed about what are our goals , our history and our programme for the future. The attendees constituted mainly of 1st,2nd and 3rd year engineering students of various colleges. The speaker for the session was Kushal Das, he told them about the Summer Training conducted by DPLUG for free every year. We told them about Open Source and how they can contribute to opensource projects. The next talk was by Praveen Kumar and was all about Fedora Project and how we can contribute to it. Next we had a really interesting talk by P.J.Prasad on Iptables. At the end we concluded the first day of the workshop with light discussions on various topics and also asked the students to get some packages installed for the next day.

::Day 2::

On the day two of the event the auditorium was teeming with eager faces , a workshop on Python was to be held. Kushal Das took the session on python along with the introduction of Vim. We had a tough time helping them to this new editor nevertheless we enjoyed doing it. Python for you and me book was followed in the session. We covered basic python commands , data structures and other basic functions of the language. By the end of the day we managed to write a program which could list down the files and folders of a directory quite similar to ls command of linux.

::Day 3::

On the day three we had workshops on flask, a web-framework based on python by Sayan Chowdhury in the first half of the day. Later In the second half we had workshop on unit test module of python by Ratnadeep Debnath where we learned to write test cases for our functions.

::Day 4::

On the Fourth day of the event we had a session on documenting our codes by Kushal Das. We introduced reStructuredText to write our documentation and then use rst2s5 to convert them to presentations. After that we used a powerful python package sphinx and prepared a demo documentation.

::Day 5::

The day five was all about how to contribute to upstream projects, Learn using Git, making patches, and other important git features and commands. After that we had a general discussion session followed by feedback session. We got many positive feedbacks and suggestions for improvement which has been noted down and will be kept in mind in the upcoming events.

Finally we talked about various projects in hand, and newer project ideas to be developed. Hoping to meet these awesome people soon at Pycon India. Till then Keep Coding! 😉

10 years of DGPLUG

Codeflu returns!!.. :)

*Sighs* Pitiful to look at this dead blog. Never-mind, its alive now! 🙂  So, what i did the last 12 months(almost)? Well, many things…

  1. Python Month workshop @ bcrec  (August 23)
  2. Pycon India (August 30 – September 1, 2013)
  3. Hackjam2bcrec (September 25,2013)

 

Other than this i spent my time working on projects such as

  • Kickchat (A chat application written in django)
  • Buff-tweet (a twitter app capable of storing and posting tweets from Cli)

Worked as an intern at OpenSourceEducation.

Spent lots of time learning and working with PHP.

This is just a preface to the upcoming blogs.

Stay tuned. 😉

Codeflu returns!!.. :)

Disabling discrete AMD Graphics card in linux

This article is posted to show how to disable the discrete AMD graphics card in a switchable graphics setup in laptops. The integrated graphics card can be an AMD or an Intel. Disabling the discrete graphics card will save your laptop from overheating and will save considerable amount of power.

This article is intended for those who are ready to have only the integrated card enabled. If you can configure both cards correctly, then you probably don’t need this. If you would like to have both cards running and want to switch between them, you need to look elsewhere.

The Problem:

I’ve a Dell Inspiron 15R model with HD 7670M discrete graphics and Ivy Bridge Intel 4000 integrated graphics card. All the distributions I’ve tried so far ran too hot with a lot of fan noise. In some cases, the laptop would turn off all of a sudden as it reached the maximum temperature it can handle!! The integrated card is capable enough to play 1080p video and desktops effects and hence I prefer the dedicated card turned off all the time.

The Solution:

  • Check if you have two graphics cards

Open ‘terminal’ and type the following command.

$lspci | grep VGA

If you see more than one graphics card, then you have a switchable graphics setup.

  • Check if both the cards are powered on

To check this, we need be able to view the file /sys/kernel/debug/vgaswitcheroo/switch. Type the following in terminal.

$cat /sys/kernel/debug/vgaswitcheroo/switch 

If you get  ‘Permission Denied’ error, then type,

$sudo chown <your user name> /sys/kernel/debug/

and then, type

$sudo chown <your user name>  /sys/kernel/debug/vgaswitcheroo/switch

Now you should be able to view the file using the ‘cat’ command given above.

If you get ‘No such file or directory’ error when trying the command ‘cat /sys/kernel/debug/vgaswitcheroo/switch’, then type

$sudo mount -t debugfs none /sys/kernel/debug

and follow the above ‘cat’ command to view the ‘switch’ file.

The result of the ‘cat /sys/kernel/debug/vgaswitcheroo/switch’ will have ‘Pwr’ in both lines (for integrated card which is denoted using the string “IGD”  and“DIS” for discrete card)  indicating both cards are powered on.

  • Disable the discrete graphics card

To disable the discrete card, type

$echo OFF >/sys/kernel/debug/vgaswitcheroo/switch

and if you check the ‘switch’ file using the ‘cat’ command given before, you can see that the ‘Pwr’ has been changed to ‘off’.

You can use a temperature or power monitoring tool to compare the power usages before and after disabling the discrete graphics card.

To have the discrete card disabled at system start-up so that you won’t have to do all these steps at every time you boot your system, you may use rc.local file.

Notes:

  • I’ve tested the above method only using the ATI/Intel available in my laptop
  • Distributions tested : Ubuntu 12.10 and Fedora 18
Disabling discrete AMD Graphics card in linux

rc.local in Fedora 16 onwards

Fedora 16 brought with itself many new features and changes from its previous versions. Fedora 16 takes advantage of several new technologies to improve the speed, security and efficiency of the boot process. The prominent changes in the boot system are:

  1. introduction of Grub2
  2. porting of SysVinit scripts to systemd
  3. rc.local is no longer  present by default

Though etc/rc.d/rc.local is no longer available by default, but it still works fine once you set it up correctly. rc.local is a file that contains commands user would like to run while booting fedora. Here in this post i will show you how to set it up in Fedora 16 and higher version of Fedora.

  • Step1: Open the Terminal
  • Step2: Type the following command to create the file, type the user password when asked for(for this you must have your username added to the sudoers list, else you may follow this tutorial to add to sudoers list) 
    $sudo vi /etc/rc.d/rc.local

    OR

    you may also do this without using sudo, in that case type this

    $su -c "vi /etc/rc.d/rc.local"

    Type the root password in when asked for.

  • Step3: Press “I” to turn on INSERT mode. Add the following to the top
    #!/bin/sh
  • Step4: Now you may add your personal commands if any. and press Esc, to exit INSERT mode. Then type “:wq” to save and close the file
  • Step5: Now to make the file executable type the following in your bash terminal
    $chmod 755 /etc/rc.d/rc.local

Once you do these steps, systemd will see the file exists, is executable and is a shell script, and will run it. No further action needed.
I hope the newer versions of Fedora keep this functionality of rc.local active as it’s sometimes handy to run things in a simple script rather than create a new unit file for it.

rc.local in Fedora 16 onwards

Adding Users to Sudoers List

“How to add an user to the Sudoers list?”, a quite common question asked by many. So here in this post i am writing the most convenient method to do it. 🙂

But before i start with the process to add an user to the sudoer list, let me tell you why we do this.

On adding a new user to the sudoers list that user will be able to run commands and open files with root user privilege.

Process to add an user to the sudoers list:

  1. Open terminal.
  2. Type the following command
    $su -c visudo

    Enter the root password.when asked.

  3. You can move the cursor using up/down arrow key. Move down to the line containing
    root ALL=(ALL) ALL
  4. press “i” to activate insert mode then add the following code just after the above line 
    <new username>  ALL=(ALL) ALL

    . So now it looks something like this

    ## Allow root to run any commands anywhere
    root ALL=(ALL) ALL
    <username> ALL=(ALL) ALL
  5. You might need to remove the # infront of the line %wheel ALL=(ALL) ALL, mine was already done so i didn’t have to remove it. So now it looks like
    ## Allows people in group wheel to run all commands
    %wheel ALL=(ALL) ALL
  6. Press Esc to come out of insert mode, then type “:wq” in the command line and press enter to save and quit from vi. And that’s it you have done it. 😀

But here in this step number 4 you assign a root privilege to the user which again compromises your security. Once added to the sudoers list the user can change the password for other users, hence it is quite not advisable if your machine got multiple users logging in as your security might get compromised.

Instead of giving root privilege to for all the commands you can specify the commands with root privilege that the user might use.

For example:

<new username>  ALL=/usr/bin/yum

If your machine is common to many users i would suggest you to allow only particular command to be executed with root privilege else if you are the sole user then like me you may allow all commands to be executed by the user with root privilege.

Here is a slideshow to show how my sudoers file is:

Adding Users to Sudoers List

mozcafe@bcrec

Few weeks ago i got the opportunity to attend the mozilla workshop #mozcafe@bcrec held in our college. It was basically about the mozilla community and their unique products. During the workshop I was made familiar with the Webmaker Tools by Mozilla like Popkorn Maker, Thimble and X-Ray Goggles.

  • Popcorn Maker : Its a handy online video editing tool. You can add popups, text tags, twitter feeds and many other elements to the video.
  • Thimble : This tool helps in testing your html codes and sharing it. You can write your html codes there and check its output webpage beside. You may even publish your webpage and forward the link to your page to your friends. 😀
  • X-ray Goggles : This was something i really loved. Its works just like its name says. It simply x-rays a webpage and unveils its html codes. You can copy the codes remix/modify the codes and make your own webpage easily. Ain’t it a smart tool?? 😉

Alright that was all about Webmaker Tools.

Next we were told about designing Mozilla logos and T-shirt. We were asked to try our skill in painting using mouse and MS-Paint(mine was a disaster). 😛

We were also told about localization of  mozilla products i.e. translating the language script of the software to your local language. This would help common people to access mozilla products easily. Also, it would save the local cultures and languages from getting extinct.  I really liked the idea behind mozilla localization.

All in all i would have missed a big opportunity if i had missed it.

mozcafe@bcrec