This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Set up a map of prices for a number of gizmos that you covet. Then produce | |
a second map with the same keys and the prices at a 10 percent discount. | |
*/ | |
val gizmos = Map("Laptop" -> 100 ,"Mobile" -> 200) | |
val tenPec = for((g,p) <- gizmos) yield (g,p-p*0.1) | |
/* | |
Write a program that reads words from a file. Use a mutable map to count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget -r --no-parent --no-host-directories --reject "mirror*,index*" http://rpm.datastax.com/community/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :- http://www.michael-noll.com/blog/2013/03/17/reading-and-writing-avro-files-from-the-command-line/ | |
download tools jar - http://mirror.catn.com/pub/apache/avro/avro-1.7.5/java/avro-tools-1.7.5.jar | |
add following to ~/.bashrc | |
alias avro='java -jar /home/yash/software/avro/avro-tools-1.7.5.jar' | |
now use just as avro command | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.util.Properties; | |
import org.apache.avro.Schema; | |
import cascading.avro.AvroScheme; | |
import cascading.flow.Flow; | |
import cascading.flow.FlowDef; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class | |
WordCountAvroWrite | |
{ | |
public static void | |
main( String[] args ) throws Exception | |
{ | |
String docPath = "sample/data/WC/input.txt"; | |
String wcPath = "sample/data/WC/out"; | |
String schemaFile = "sample/data/WC/input.avsc"; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo -u <user> <command>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
su su - | |
mkdir ~/tmp | |
cd ~/tmp | |
wget http://10.13.130.62:9999/jdk-7u51-linux-x64.rpm | |
rpm -ev jdk | |
rpm -ihv jdk-7u51-linux-x64.rpm | |
update-alternatives --remove-all java | |
update-alternatives --install "/usr/bin/java" "java" "/usr/java/latest/bin/java" 1 | |
update-alternatives --set java /usr/java/latest/bin/java | |
source /usr/lib64/cmf/service/common/cloudera-config.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
du -s /data/sub_dir/*/* | awk '{sum=sum+$1} END {print ((sum / NR) /1024)/1024 " GB"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
netstat -antu |egrep ':8006|:8007|:8008|:8010' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feb 26, 2014 9:28:05 AM com.google.api.client.http.HttpRequest execute | |
CONFIG: -------------- REQUEST -------------- | |
POST https://accounts.google.com/o/oauth2/token | |
Accept-Encoding: gzip | |
User-Agent: Google-HTTP-Java-Client/1.17.0-rc (gzip) | |
Content-Type: application/x-www-form-urlencoded; charset=UTF-8 | |
Content-Length: 208 | |
Feb 26, 2014 9:28:05 AM com.google.api.client.http.HttpRequest execute | |
CONFIG: curl -v --compressed -X POST -H 'Accept-Encoding: gzip' -H 'User-Agent: Google-HTTP-Java-Client/1.17.0-rc (gzip)' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -d '@-' -- 'https://accounts.google.com/o/oauth2/token' << $$$ |