Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Saturday, 13 September 2014

How to run or execute a program n number of times in a terminal/command line?

If you want to run or execute a program n number of times,you can create a shell script or you can use the native commands provided in the terminal it self.It depends on your convenience.

For example you can use this one

You can use xargs and seq. Generally:

seq nr_of_times_to_repeat | xargs -Iz command
For example:

seq 10 | xargs -Iz xdotool click 1
will execute the xdotool click 1 command for 10 times. 



if you want to use a script

then use this


#!/bin/bash

x=1
while [ $x -le 10 ]
do
  <command to run>
  x=$(( $x + 1 ))
done
where 10 is the number of times to run the command
if you need to build in a little break:
#!/bin/bash

x=1
while [ $x -le 10 ]
do
  <command to run>
  sleep 1
  x=$(( $x + 1 ))
done
Copy the script into an empty file, replace <command to run> by your xdotool command, save it as run_xdotool.sh, run it by the command:
sh /path/to/run_xdotool.sh
Alternatively, you can make it executable and simply run it by
/path/to/run_xdotool.sh

How to transfer and copy files from/to an Android device with ADB via GUI?

There are various ways of doing this.

First of all you should have adb tools installed,go to the google dev site and download the latest adb tools and update it.I hope your device is rooted too to perform this operation.

sudo apt-get install mtp-tools mtpfs
$ mkdir phone
...Connect phone, set usb mode to MTP...
$ sudo mtpfs -o allow_other phone
...Trying to do anything with the new filesystem right now will take a minute or so, just be patient...
...Finally, you can access your phone and do whatever, then...
$ sudo umount 
 
This is the version I used 
mtpfs --version
FUSE library version: 2.8.6
fusermount version: 2.8.6
using FUSE kernel interface version 7.12 
 
 

Realtek RTL8723AE-BT stops working when Kernel 3.5.0-21 is used

Realtek RTL8723AE-BT stops  working when Kernel 3.5.0-21 is used ,how to make the Realtek RTL8723AE-BT work?

The model is: Realtek RTL8723AE Wireless LAN 802.11n PCI-E NIC

Install the new kernel ,them recompile ,run the update manager so that all the repositories and dependencies are updated .
Then do this 
cd Desktop/RT8723  <--or wherever you compiled the package
sudo su
make clean
make
make install
modprobe rtl8723e
exit
 
then do this 
./scripts/driver select rtlwifi
make
sudo make install
sudo modprobe rtl8723ae
You 'make clean' because the module was compiled originally against your specific versions of kernel, headers, gcc, etc. When updates are installed, the various files built in the compile process may or may not work correctly with, for instance, a newer gcc version, so wipe it all out and start fresh: make clean