Tech
Infected

Linux, OpenSource, Programming And Hacks

Sep 30, 2016

Run Python SimpleHttpServer on Amazon AWS EC2

Sep 30, 2016
With Python's SimpleHTTPServer you can quickly setup a webserver without any hassle. In order to use it, you don't need to install or configure anything.. you just need to have python installed on your server.

Step 1: Open up your AWS console and in your instance security group make the Inbound & Outbound settings like shown in the sceenshots below



Step 2: Login into your remote server via ssh

example:
aman@vostro:~$ ssh -i yourkeyfile.pem ubuntu@your-server-ip

Sep 27, 2016

Ubuntu Installer does not show existing Partitions but free space [fixed]

Sep 27, 2016
If during ubuntu installation you don't see your existing partitions but all free space then there might be two possibility.

1. You have both GPT and MBR partition tables present on your hard disk.. It is generally caused when you install different windows in the past which used a different partition table scheme (MBR or GPT). So you end up with both Schemes. So we must make all partition scheme the same.

Check if you have multiple partition schemes with this command

sudo gdisk -l /dev/sda

In the screenshot below, It shows that MBR and GPT both are present.


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!!