Use it only when you have to do. For example,
namespace X {
double std(::std::vector<double> const& values) { … }
void foo(::std::vector const& values) {
#!/bin/sh | |
tar -xzvf eclipse*.tar.gz -C /opt | |
chmod -R +r /opt/eclipse | |
# use the technique "HERE document" | |
# http://tldp.org/LDP/abs/html/here-docs.html | |
(cat <<'EOF' | |
#!/bin/sh | |
export ECLIPSE_HOME="/opt/eclipse" | |
$ECLIPSE_HOME/eclipse $* |
ack DataMode.OPTIONAL | awk 'BEGIN {FS =":"} {print $1}' | xargs sed -i "s/DataMode.OPTIONAL/DataMode.DM_OPTIONAL/g" |
# Let us assume | |
# | |
# - you have a laptop A | |
# - you work at company C | |
# | |
# how can you access C from A? | |
# | |
# Solution: a middle man B | |
# | |
# http://www.revsys.com/writings/quicktips/ssh-tunnel.html |
#!/bin/sh | |
# http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.0.0.2/bk_reference/content/reference_chap3_1.html | |
export HIVE_HOME=/opt/hive/hive-0.12.0-bin/ | |
export HIVE_CONF=$HIVE_HOME/conf.drill/ | |
su -l hive -c "env HADOOP_HOME=/usr nohup $HIVE_HOME/bin/hive --service metastore > /tmp/hive.out 2> /tmp/hive.log &" | |
su -l hive -c "nohup $HIVE_HOME/bin/hiveserver2 -hiveconf hive.metastore.uris=\" \" > /tmp/hiveServer2.out 2>/tmp/hiveServer2.log &" |
#!/bin/sh | |
# Stop Hive (kill all process owened by user 'hive') | |
ps aux | awk '{print $1,$2}' | grep hive | awk '{print $2}' | xargs kill >/dev/null 2>&1 |
select | |
cast('2008-2-23' as date) as DATE_TYPE, | |
cast('12:20:30' as time) as TIME_TYPE, | |
cast('2008-2-23 12:00:00' as timestamp) as TIMESTAMP_TYPE | |
FROM | |
INFORMATION_SCHEMA.`SCHEMATA`; |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
# http://docs.python.org/faq/programming.html#how-do-you-remove-duplicates-from-a-list | |
mylist = list(set(mylist)) |
# http://stackoverflow.com/questions/893417/item-frequency-count-in-python | |
# defaultdict will automatically initialize values to zero. | |
from collections import defaultdict | |
words = "apple banana apple strawberry banana lemon" | |
d = defaultdict(int) | |
for word in words.split(): | |
d[word] += 1 |