Tech
Infected

Linux, OpenSource, Programming And Hacks

Jun 10, 2017

How to install and use package control in sublime text 3

Jun 10, 2017
Package Control is the Sublime text package manager with which we can easily search and install thousands of packages thus extending sublime text functionality.

Since Sublime text is cross platform so these instruction will work with all Operating Systems: Linux, Windows and OS X.


Jun 7, 2017

Responsive Iframe / youtube videos embed with Bootstrap

Jun 7, 2017
Hi guys, today we will see how to make iframe videos responsive using bootstrap framework.

Since the embed code for a youtube video is a iframe code, this is work for youtube videos too.

Have a look at this bootstrap link

http://getbootstrap.com/components/#responsive-embed

all you got to do is wrap your iframe code in a embed-responsive like shown below


<!-- 16:9 aspect ratio -->
<div class="embed-responsive embed-responsive-16by9">
  <iframe class="embed-responsive-item" src="..."></iframe>
</div>

<!-- 4:3 aspect ratio -->
<div class="embed-responsive embed-responsive-4by3">
  <iframe class="embed-responsive-item" src="..."></iframe>
</div>



Jun 6, 2017

How to Install Sublime text 3 in ubuntu / linux mint

Jun 6, 2017
Sublime text is a powerful text editor that is available for almost all platforms. It is one of the best text editor for linux and I personally prefer it. It has thousands of packages which add up to its functionalities.

Sublime text is free to use though they ask for a full-time registration sometimes but you may ignore it and continue using it.




Here we will see how to install the latest sublime text 3 from their official repository so that we will be getting updates as well.


May 14, 2017

Use Bluetooth Headphone or Speaker on Ubuntu 16.04 [Solved]

May 14, 2017
I recently got a soundbot wireless portable speaker, which is by the way really great! but It had some issues making it work with ubuntu.

After pairing it was working with Headset Head unit (HSP/HFP) which produced a really bad audio quality.

to get the sound right It should be using the High Fidelity playback (A2DP Sink) but it wouldn't select that profile from the sound preferences.


May 13, 2017

Install latest Node.js version in ubuntu 16.04

May 13, 2017


Node.js is an opensource JavaScript based framework for server-side scripting.


Ubuntu Repository has the older version of node.js

To get the updated version you need to install node.js using the PPA by provided by NodeSource.

for 6.x versions (LTS version)

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -

for 7.x versions (current active release)

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -

after this the PPA will be added and repository will be updated automatically,

now install the updated node.js version

sudo apt-get install nodejs



Apr 8, 2017

How to Add / Append items to a list in Python

Apr 8, 2017
To add items to a list in python is a very general task that you might come across.

Here we have an empty list that we are populating with 10 items using the append method.

n = 10

list = []

for i in range(n):
    list.append(input())

print list

That's it!

Common Mistake

its a common mistake of doing something like this

n=10
list=[]

for i in range(n):
    list[i]=input()

this will throw an error IndexError: list assignment index out of range

Because the list is empty and list[i] is trying to access index which does not exist!

Apr 7, 2017

Set Permissions to add files to /var/www folder in ubuntu linux

Apr 7, 2017
/var/www is the default root folder of your local web server (like apache), you host all your website files here and access it on the browser with url like http://127.0.0.1 or http://localhost

you cannot simply copy paste stuff in this folder using your file browser, It is protected for security reasons, you will get a permission denied error message because by default you don't have write access permission here.


Follow these Steps:

execute these commands to set all permissions for /var/www directory


sudo adduser <username> www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rwX /var/www
replace <username> with your actual username.

Now you can copy, edit and create files in /var/www folder just like any other folder.

Jan 29, 2017

How to install python-gst (pygst) in ubuntu 16.04

Jan 29, 2017
pygst is the python binding of Gstreamer which is a media-framework, it supports various media handling such as audio playback, video playback and editing.

Installation

open up the terminal and enter the following commands

sudo apt-get update
sudo apt-get install python-gst-1.0
sudo apt-get install python-gst-1.0-dbg
sudo apt-get install python-gst0.10

Check if its working properly

open up your python shell and import pygst

aman@vostro:~$ python
Python 2.7.11+ (default, Apr 17 2016, 14:00:29) 
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygst
>>> 

if its not installed properly then an error message will be shown: ImportError: No module named pygst

Dec 10, 2016

Syntax Highlighting with Google code-prettify and bootstrap

Dec 10, 2016
Google Code Prettify automatically detects your source code and highlights it accordingly. It's quite simple to setup.


Nov 21, 2016

Python Program for Binary Search with explanation

Nov 21, 2016
Binary search algorithm is used to find a number in a sorted list. so, the pre condition for binary search is that the list should be sorted. If the number is found then its index is returned.
This algorithm works on divide and conquer principle.


Nov 14, 2016

How to style Django Forms with Bootstrap

Nov 14, 2016
Though we can use third-party packages like Django-Crispy forms to style forms in django with ease but still it's sometimes required to style django generated forms all by yourself, here we will see how to do that. the form will be able to show errors also.

Nov 13, 2016

Python Program to reverse a number using loop

Nov 13, 2016
Here is a simple program to find the reverse of an entered number. Please note that this program works for only positive integers.


Nov 8, 2016

Connect Filezilla with Amazon EC2 Ubuntu Server

Nov 8, 2016
In this quick guide we will learn how to connect to your amazon aws ec2 ubuntu server using a FTP client like Filezilla.

1. first make sure filezilla is installed
sudo apt-get install filezilla


Nov 5, 2016

Make all Images responsive with bootstrap automatically!

Nov 5, 2016

Hi guys, in this post we will see how to make all images on your website responsive automatically with bootstrap. this will get rid of the problem of the images breaking out of the content area of your website on any kind of display.

I have written a simple script that will apply the img-responsive bootstrap class to all your images.


Oct 31, 2016

Install JavaScript & CSS Minifier in Sublime text 3

Oct 31, 2016

This is a short guide on how to install Javascript & CSS Minifier, called Sublime-Minifier. This minifier works for both sublime text 2 and 3 and supports all platforms -  Linux, Mac OS & Windows.