Skip to main content

Posts

youtube-dl (Command Based Youtube Downloader)

Downloading youtube.com videos to local machine is always a challenge as the streaming sites keep on updating their policies in blocking the videos. But there is a tool that is available in the command line (Terminal based) on Linux Operating Systems. That is youtube-dl, this is a python based code and can be executed in linux OS without any hassles. youtube-dl in windows or Mac OS can be achieved by installing python interpreter and try it. for installing in linux, the command is $prompt] sudo yum install youtube-dl (in redhat or centos or fedora) $prompt]  sudo apt-get install youtube-dl (ubuntu or linux mint) See the image for downloading in Fedora 20 Youtube-dl in Fedora 20 In ubuntu, you can update the sudo package before installing the youtube-dl. sudo apt-get update To download videos  $prompt] youtube-dl http://www.youtube.com/watch?v=D980jXvyKUY the above command will download the video in the best possible format. See the image below. ...

Blogging and Google Adsense get me a DSLR Camera

By blogging and Google Adsense, my long time wish have come true that I got an DSLR (Nikon D5100).  Nikon D5100 Blogging is a word that seems to be a "No man's Land" when I started this blog in 2006. Yes I started this blog mainly for providing lecture notes to my students. Initially I started this with blogger.com and a year later, I purchased  www.pradeepkumar.org  (this website) and shared contents.  Initially I was not bothered about the ranking, search engine optimisation (SEO), page rank, etc. My main motive was to create content for the student community. Slowly, I improvise my contents to satisfy the global readers too. The topics that covered in my domains play a vital role in the provide information to open source research community.  The topics of interest are  Network simulator 2 Linux Open Source Technologies MOODLE Wordpress PHP, MySQL Real TIme Systems Embedded systems, Java and etc. This website was hacked twice an...

nohup command in Linux

Often you come across a situation where you try to open a machine remotely using ssh and try to start a server or a run a command indefinitely. But once you close the ssh session, your session also terminates and the background process also terminates. So here is a solution. To open ssh remotely, prompt $] ssh username@machinename Ex: ssh root@172.16.1.1 Ex: ssh root@example.com  prompt $] ssh -X username @machinename  Ex. ssh -X root@172.16.1.1  (this -X indicates the remote session can be opened in X window (GUI) mode) Assume we need to start a httpd server in the remote machine. we can issue the command like this usage: prompt$] nohup command  if any error or log information may be stored in the nohup.out file. if you want to redirect to a file use the redirected symbol (1>  indicates standard output and 2> indicates standard Error). Specify the filenames for the output. Here is the typical nohup command to start the httpd s...

How to display Product name and Vendor name in Linux

This post will help you to find out the Product Name System Vendor Name  This will help you to find the suitable device drivers if any. The following is the command to find the System Vendor (in my case it is Hewlett Packard) prompt $] cat /sys/class/dmi/id/sys_vendor Here is the command to find the product name prompt $] cat /sys/class/dmi/id/product_name Printing the System Vendor and Product Name cat is the command to concatenate the files and print it to the standard output  T S Pradeep Kumar

C Programming Examples - Part 2

Here is the list of sample programs using C, This is list number 2. There are 21 more programs at this post. http://www.nsnam.com/2014/10/simple-c-programs-for-beginners.html C Program 1 – To find the reversal of a given number Assume the number 1234, after reversal the number becomes 4321. Input: One number, Ex 1234, declared to num Output : One number, Ex 4321, rev is the variable Logic: separate each digit using modulo operator from the right and bring that number to front divide the given number by 10, so the right most digit will be discarded. run till the number becomes <=0 output the result #include <stdio.h> #include <conio.h> int main() {     int num,rev=0;     printf("enter the number to be reversed");     scanf("%d", &num);     while(num>0) //till the number is positive, perform the process     {     rev=...

Passing a Structure to a Function

A function can accept a structure as a parameter and even it returns a parameter too. Either the individual structure elements can be passed or the entire structure can be passed. Here is the example, for passing the entire structure to a function #include <stdio.h> #include <conio.h> //Structure declaration struct student { char name[10]; int no; }; //Function prototypes void read(struct student); struct student display(struct student); //function which takes the entire structure as a parameter and it returns a structure also int main() {     struct student s1,s;      printf("Enter the details");     scanf("%s %d",s1.name,&s1.no);     s=display(s1);  //function call printf("Name is %s and number is %d",s.name,s.no);     getch(); } //Function definition struct student display(struct student s) { ...

Structures and Unions

Structure in C groups different data type under a common name struct is a keyword to declare a structure The size of the structure depends on the size of the different data types Structure declaration always ends with a semicolon Example: struct employee { char name[50]; int empid; float salary; }; The total size occupied by the above structure is 50 + 2 + 4 = 56 bytes (on TC compiler) and 50 + 4 + 4= 58 (on other compilers like GCC, etc). Again the size depends on the compiler. GCC compiler always increase the size of structure which is divisible by 4 for faster code generation, so the above structure takes 60 bytes of memory Declaring a structure does not consume any memory, only when the structure object is created memory occupies Variables initialization will not be done during the structure declaration The above syntax declaration does not consume memory, but the following do int main() { struct employee e1; } Now e1 consumes memory of 60 bytes. S...