Skip to main content

Posts

Showing posts from 2016

Tired of reading - Little python script to speak the selected word

python code here import  os   import  time   import  pyperclip time . sleep(2) os . system( "xdotool key --delay 13 ctrl+c" ) x = pyperclip . paste () f = open( "/tmp/temp" ,  "w" ) length   =  f . write(x) f . close () time . sleep(1) os . system( "espeak -f /tmp/temp" )   dependencies:      pyperclip  - python library to get text from clipboard      epseak       - convert text to speak (linux)       xdotool     - send key strokes working      Select the text to speak       Then press a key stroke ( assign th python script to key stroke )       The data selected is copied to clipboard and using python get the clipboard data using pyperclip and store it in temp file       pass the file to the espeak any doubts drop comment below

C program - sort Big than small

i/p : 1 2 7 8 o/p : 8 1 7 2 # include < stdio.h > void sort ( int * a , int n ) { //bubble sort //i/p : *a - array is passed as reference && n -no of terms int temp , i , j ; for ( i = 0 ; i < n ; i + + ) { for ( j = 0 ; j < n ; j + + ) { if ( a [ i ] < a [ j ] ) { temp = a [ j ] ; a [ j ] = a [ i ] ; a [ i ] = temp ; } } } } int main ( ) { int a [ 10 ] , n , i , cnt_var , l = 0 , m ; // l -> to points the first element in array printf ( " Enter the n terms : " ) ; scanf ( " %d " , & n ) ; printf ( " Enter the array elements : " ) ; for ( i = 0 ; i < n ; i + + ) scanf ( " %d " , & a [ i ] ) ; //call sort function to sort the array (! array is passed as reference ) sort ( & a , n ) ; //cnt_var -> control variable of the loop cnt_var = 0 ; //m -> to points the last position in array m = n - 1 ; //logic is for every even num

Apps that make I3 window manager Awesome

Few apps that i know dunst - notification manager i3blocks - configure the status bar of the i3wm wide varity of command line tools cmus - command line music player Ranger - command line File manager ffmpeg - command line audio/video converter ffplay - command line audio/video player htop - Task Manager w3m  ---| links ----> These are command line browsers lynx ---| tmux - terminal multiplexer ( awesome application ) mpg123 - command line mp3 player irssi - command line IRC client netcat - must have network troubleshooting software cryptcat - netcat's sister with encryption TwoFish if know other apps drop it in commands

Linux Timeline

Linux started as hobby by "Linus Torvalds" August 1991 “Hello everybody out there using minix - I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. This has been brewing since april, and is starting to get ready. I'd like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same physical layout of the file-system (due to practical reasons) among other things).I've currently ported bash(1.08) and gcc(1.40), and things seem to work. This implies that I'll get something practical within a few months, and I'd like to know what features most people would want. Any suggestions are welcome, but I won't promise I'll implement them :-) Linus (PS. Yes - it's free of any minix code, and it has a multi-threaded fs. It is NOT protable (uses 386 task switching etc), and it probably never will support anything other than AT-harddisks, as that's all I ha

C program jackpot

/*Program to show sum of 10 elements of array & show the average.*/ #include<stdio.h> int main () { int a[ 10 ],i,sum = 0 ; float av; printf( "enter elements of an aaray: " ); for (i = 0 ;i < 10 ;i ++ ) scanf( "%d" , & a[i]); for (i = 0 ;i < 10 ;i ++ ) sum = sum + a[i]; printf( "sum=%d" ,sum); av = sum / 10 ; printf( "average=%.2f" ,av); return 0 ; } Output: enter elements of an array : 4 4 4 4 4 4 4 4 4 4 sum = 40 average = 4.00 /*Program to find the maximum no. in an array.*/ #include<stdio.h> void main () { int a[ 5 ],max,i; printf( "enter element for the array: " ); for (i = 0 ;i < 5 ;i ++ ) scanf( "%d" , & a[i]); max = a[ 0 ]; for (i = 1 ;i < 5 ;i ++ ) { if (max < a[i]) max = a[i]; } printf( "maximum no= %d" ,max); } Output: enter elements for array : 5 4 7 1 2 maximum no = 7 /*Swapp