Tech
Infected

Linux, OpenSource, Programming And Hacks

Aug 24, 2016

Code Syntax Highlighting in django with Pygments

Aug 24, 2016

Syntax Highlighting is a very much useful if you put code on your website. This can be easily achived with django-pygments. over 300 languages are supported.

List of supported Languages: http://pygments.org/languages/

django-pygments is the implementation of the pygments syntax highlighter for django.
usage is quite simple. after setting up everything, you need to put necessary template tags and then place your code in pre tags with a lang attribute specifying the language of the source code in your template.

example: <pre lang="python">YOUR CODE</pre>


1. First, Install the following packages.

pip install pygments
pip install django-pygments

Aug 17, 2016

How to Change your django Project name

Aug 17, 2016

It's possible to rename a project in django. you just have to replace your existing project name in the following places with the new one.

Your django project structure

ProjectName/
         manage.py 
         ProjectName/ 
                 __init__.py 
                 settings.py 
                 urls.py 
                 wsgi.py

Rename your project directory (ProjectName) and the following inside your project directory.

settings.py

ROOT_URLCONF = 'NewProjectName.urls'
WSGI_APPLICATION = 'NewProjectName.wsgi.application'

wsgi.py

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "NewProjectName.settings")

manage.py

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "NewProjectName.settings")


There is no need to make any changes to any of your apps.

Jun 15, 2016

How to Loop or Repeat a Youtube Video without any third-party website

Jun 15, 2016
Now, its possible to loop a video in youtube without the use of any third-party website/software.

All you need to do is Right Click on the current playing video and select the Loop option. That's it!!


Jun 12, 2016

How To Create Torrent Files & Seed/Share Them Using Transmission on Linux/Mac

Jun 12, 2016
You would have downloaded files via torrent many times but have you ever uploaded one?

I am using Ubuntu but the process will be same for any Linux distro or Mac OS

Let's get started, first open up Transmission and follow these steps.

May 27, 2016

How to Comment and Uncomment Multiple Lines in Vim

May 27, 2016

There are several ways you can comment and uncomment a range of lines in vim editor.

Commenting 


Method I (easiest)

Step 1: Make sure your are in command mode by pressing Esc key

Step2: Move your cusor to the start of the starting line of the block that you want to comment out
press Ctrl + v for visual mode and now press the press down arrow key to select till the last line you wanna comment.

Step 3: Press upper case I (shift + i)
and type # or // for commenting depending on the programming language.
and finally press Esc key

wait a sec and it's done!