Wednesday, January 29, 2014
Convert word doc to md file
textutil -convert html ~/Downloads/UniquereachImpressionBreakdown.docx -stdout | pandoc -f html -t markdown -o output.md
Monday, January 27, 2014
Bash Format and Send Email
printTable.sh
#!/bin/bash
#
# Script that output a hive table to a file
if [ $# -ne 3 ]
then
echo "Script that output a hive table to a file."
echo "Usage: $0 <db_name> <table_name> <output_path> "
exit 1
fi
DB_NAME=$1
TABLE_NAME=$2
OUTPUT_PATH=$3
echo "use $1; select * from $TABLE_NAME;" | /home/insights/insights/hive/hv | tail -n+3 | head -n-1 > $OUTPUT_PATH
if [ "$email" != "email" ]
then
for line in $(echo $email | tr ',' '\n')
do
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no abc@host1 "(cd insights/bin; sh printTable.sh bi_insights tmp_kfb_user_meta ~/gfan/kfb_user_meta_$date.tsv && echo -e "brand_ks_uid\thandle\tbrand\temail\ttw_followers\tfp_likes\tnum_activities_90days\tcity\tstate\tcountry\tkdc_created_at" | cat - ~/gfan/kfb_user_meta_$date.tsv > ~/gfan/tmp && mv ~/gfan/tmp ~/gfan/kfb_user_meta_$date.tsv && zip ~/gfan/kfb_user_meta_$date.zip ~/gfan/kfb_user_meta_$date.tsv && echo 'Data Format: brand_ks_uid | handle | brand | email | tw_followers | fp_likes | num_activities_90days | city | state | country | kdc_created_at' | mutt -s 'KFB User Meta' $line -a ~/gfan/kfb_user_meta_$date.zip)"
done
fi
#!/bin/bash
#
# Script that output a hive table to a file
if [ $# -ne 3 ]
then
echo "Script that output a hive table to a file."
echo "Usage: $0 <db_name> <table_name> <output_path> "
exit 1
fi
DB_NAME=$1
TABLE_NAME=$2
OUTPUT_PATH=$3
echo "use $1; select * from $TABLE_NAME;" | /home/insights/insights/hive/hv | tail -n+3 | head -n-1 > $OUTPUT_PATH
if [ "$email" != "email" ]
then
for line in $(echo $email | tr ',' '\n')
do
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no abc@host1 "(cd insights/bin; sh printTable.sh bi_insights tmp_kfb_user_meta ~/gfan/kfb_user_meta_$date.tsv && echo -e "brand_ks_uid\thandle\tbrand\temail\ttw_followers\tfp_likes\tnum_activities_90days\tcity\tstate\tcountry\tkdc_created_at" | cat - ~/gfan/kfb_user_meta_$date.tsv > ~/gfan/tmp && mv ~/gfan/tmp ~/gfan/kfb_user_meta_$date.tsv && zip ~/gfan/kfb_user_meta_$date.zip ~/gfan/kfb_user_meta_$date.tsv && echo 'Data Format: brand_ks_uid | handle | brand | email | tw_followers | fp_likes | num_activities_90days | city | state | country | kdc_created_at' | mutt -s 'KFB User Meta' $line -a ~/gfan/kfb_user_meta_$date.zip)"
done
fi
Friday, January 10, 2014
JUnit Test Note
Test on CL:
java -cp /Users/guangle/.m2/repository//junit/junit/4.8.1/junit-4.8.1.jar:target/thunder-libs-0.0.71.jar org.junit.runner.JUnitCore com.klout.thunder.common.UrlSummaryNormalizerTest
Subscribe to:
Posts (Atom)