Buy Moto series phones: Moto E, Moto G, Moto X or Other phones
Buy eBooks from Flipkart
-----------------------------------------------
For loop example in bash script:
To get yarn log files for multiple spark jobs, we can use this command.
for i in `cat appid.txt`; do echo $i; yarn logs -applicationId $i > sparkjob_01sep_logs/$i.log; echo "——"; done
For loop with sequence and ssh into multiple servers:
To login into multiple servers and run a command, we can use below command.
for i in `seq 101 125`;do ssh -q machinename$i "hostname;ls -ltr";done
Wednesday, November 1, 2017
Bash for loop examples
Friday, February 10, 2017
Java - redirect standard output stream to file
Buy Moto series phones: Moto E, Moto G, Moto X or Other phones
Buy eBooks from Flipkart
-----------------------------------------------
We can redirect all System.out.println output to a file with below code snippet.
System.setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream("/tmp/output.txt"))));
Posted by Reddy at 10:32 AM 0 comments
Monday, January 30, 2017
Create a desktop shortcut in Mac with Automator
Buy Moto series phones: Moto E, Moto G, Moto X or Other phones
Buy eBooks from Flipkart
-----------------------------------------------
Open Automator
File > New
select Application
Then add "Run Shell Script" option
Give the command to run, here I am giving Google chrome canary with no proxy option
/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --no-proxy-server=Then Save with the name you want.
By default this will show automator icon.
Here is how to set your favorite icon.
Right click on Chrome canary icon and select "Get Info"
Then click on the icon and press Cmd+c
to copy the icon.
Now open info window on newly created icon, select the icon in the same place (which shows automator icon) press Cmd+v to paste the previously copied icon.
Change proxy settings only for Chrome
Buy Moto series phones: Moto E, Moto G, Moto X or Other phones
Buy eBooks from Flipkart
-----------------------------------------------
Disable proxy setting
Add command line parameter --no-proxy-server= to the command. (In windows, add this to the target path in the shortcut properties)
Specify different proxy
Add command line parameter --proxy-server="127.0.0.1:8080" to the command
Specify no proxy server list
Add command line parameter like this --proxy-bypass-list="127.0.0.1;localhost"
Posted by Reddy at 2:18 AM 0 comments