Wednesday 6 January 2016

How to create a simple Docker image

WHY
I tried to download a video from vimeo using youtube-dl;but it gave an error .When i googled the error it said the issue was resolved in latest release and the youtube-dl version was using was from debian repository and it was and up to date .So i thought why not create docker image for the solution as it would be a good learning experience.
[if you dont have docker installed =>http://pid7007blog.blogspot.ae/2015/11/howto-installing-docker-in-debian-8.html]
HOW
Docker is a software that lets you virtualize operating systems like virtual box but docker is much more flexible and lightweight.For this we will be using docker and youtube-dl. youtube-dl is a python application for downloading videos from various sites like youtube,vimeo etc.

Part one -Lets create a image[image is like .iso file for docker ] using debian as base.
1-Create your working directory called youtubedl . mkdir youtubedl
2-Create a file called "Dockerfile". touch Dockerfile
3-Copy these lines to "Dockerfile"
#create base image from debain
FROM debian:latest
MAINTAINER kamilkabir9 <kamilkabir9@gmail.com>
RUN apt-get update&&apt-get install -y python3-pip
#install youtube_dl
RUN pip3 install --upgrade youtube_dl
#create a dir called dataBucket
RUN mkdir dataBucket
#point working dir to dataBucket
WORKDIR /dataBucket
4-Run this command docker build -t myyoutubedl . (DONT forget dot)This command builds images according to the "Dockerfile"
5-Now when you check local images using command docker images, you can see a image called myyoutubedl

Part two- How to run your newly created image and download a youtube video
1-Go to directory where you want to download a video for example /home/usr1/myvideos
2-Run command docker run -it  -v $(pwd):/dataBucket myyoutubedl "$(pwd)" is the working dir ; /home/usr1/myvideos in this case
3-Now when your inside the docker container ,you can see something like
root@228102d3cbd1:/dataBucket#
4-Run youtube-dl https://www.youtube.com/watch?v=tPEE9ZwTmy0
5-To exit from docker container type ctrl+p+q
6-Now you can see downloaded video in your local dir (or as example  /home/usr1/myvideos)
Done :)

Tuesday 17 November 2015

How to install Docker in Debian 8

Steps(run these commands as root)
1-apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
2-echo "deb https://apt.dockerproject.org/repo debian-jessie main">>/etc/apt/sources.list.d/docker.list
3-apt-get update
4-apt-get install docker-engine
5-service docker start
6-docker run hello-world
Now you can docker as root but not as a normal user.Make a user group to run Docker as a normal user.
7-gpasswd -a changethisToNormalUsername docker
Done :)
Adapted from https://docs.docker.com/engine/installation/debian/#debian-jessie-80-64-bit

Saturday 7 November 2015

How to clone OpenFrameWorks documentation in Debian

Its helpful to have documentation of openFrameworks locally.Its possible to clone websites using wget but the good thing of using git is you can always update your clone with real one.

Follow these steps to clone documentation locally

1-git clone https://github.com/openframeworks/ofSite.git
2-install blogofile or apt-get install blogofile python-levenshtein
3-cd your git cloned folder
4-blogofile build
5-blogofile serve
6-go to http://127.0.0.1:8080/

Now you have openFrameworks website running locally :) 

Friday 10 July 2015

Installing Android studio in Debian 8

Installing Android studio in Debian 8
1- Make sure you have java jdk>=7.0 {if not link}

2- Install this package lib32stdc++6 using synaptic-pkexec or run this "apt-get install lib32stdc++6"

3- Download Android sdk link

4- Extract it

5- goto(cd to)  "android-studio/bin" directory

6-  you can see( ls ) there is bash file called studio.sh ;Run it using command "./studio.sh"

7- <optional> if you want you create a desktop icon for Android studio copy(blue lines) the following lines and change Exec and Icon to match your file path;then save it as Android sdk.desktop

[Desktop Entry]
Version=1.0
Name=Android studio
GenericName=Android studio
Exec=/home/usr1/android/sdk/android-studio/bin/studio.sh
Terminal=false
Icon=/home/usr1/android/sdk/android-studio/bin/studio.png
Type=Application

Install java(oracle) in Debian 8

Install java(oracle) in Debian 8
(here is the .deb file i created gdrive link)
1-Download java jdk from oracle website
2- Install java-package from debian repos using command "apt-get install java-package"
3-Run this command to create .deb file "make-jpkg jdk-8u45-linux-x64.tar.gz"
4 Install .deb file using "dpkg -i oracle-java8-jdk_8u45_amd64.deb"
5-Run this command to check java version "java -version"

Thursday 9 July 2015

Copy google-chrome[data] From computer A to computer B

Copy google-chrome From computer A to computer B
Sometime you need all your book marks ,most visited pages and everything from machine A to B.so here its copy everything in
"/home/usr1/.config/google-chrome/Default" of A to
"/home/usr1/.config/google-chrome/Default" of B.

[Tested on Linux/GNU Debian 8]

Wednesday 8 July 2015

Auto indent code in Sublime

Auto indent code in Sublime
Goto Preference > Key Bindings- Default
write this in file { "keys": ["ctrl+shift+r"], "command": "reindent" , "args": { "single_line": false } }


(src:http://stackoverflow.com/questions/8839753/how-do-i-reformat-html-code-using-sublime-text-2)