query = '''SELECT COALESCE(SUM(imp), 0) AS imps,
COALESCE(SUM(click), 0) AS clicks
FROM logCuDate
WHERE id=%s
AND date >= %s
AND date <= %s'''
res = db.executesql(query, args, as_dict=True)
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
.home .thumb { display: none; } | |
.comment-reply-link { | |
background: url(/wp-content/themes/Lucid/images/more-arrow.png) no-repeat center right; | |
} | |
.article { padding: 14px; } | |
.post_content { padding: 36px 14px 30px 14px; } | |
#main-area .container { width: 1000px; } | |
#left-area { width: 670px; } | |
.flexslider img { width: 1000px; } |
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
function trace() { | |
local DEV_ROOT=~/dev/branch | |
local dir=$DEV_ROOT/booking/gui/applications/${1:-booking}/errors/ | |
local ticket=`ls -1t ${dir} | head -1` | |
python -c "import cPickle as pickle; print pickle.load(open('${dir}/${ticket}', 'r')).get('traceback')" | |
} |
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
Install XCode & Command Line Tools | |
curl -O http://python-distribute.org/distribute_setup.py | |
sudo python distribute_setup.py | |
sudo easy_install pip | |
sudo pip install virtualenvwrapper |
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
# Prompt setup (c) smax 2002, adapted for zsh (c) piranha 2004 | |
# 0-black, 1-red, 2-green, 3-yellow, 4-blue, 5-magenta 6-cyan, 7-white | |
Cr() { echo '%{\033[3'$1'm%}'; } | |
hc=`Cr 6`; wc=`Cr 3`; tc=`Cr 7`; w=`Cr 7`; n=`Cr 9`; r=`Cr 1`; y=`Cr 6`; gr=`Cr 2` | |
[ $UID = 0 ] && at=$r%B'#'%b || at=$w'@' | |
PW_LEN=25 | |
PS1="$wc%n$at$hc%m $wc%$PW_LEN<..<%~$w>$n" | |
export RPROMPT=$(echo "$gr%T$n") | |
unset n b Cr uc hc wc tc tty at r y gr |
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
QUERY PLAN | |
-------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
Nested Loop (cost=0.00..6275.34 rows=882 width=163) (actual time=0.448..1058.363 rows=75615 loops=1) | |
Join Filter: (((msg.src_addr)::text ~~ (('380'::text || (mnc.code)::text) || '%'::text)) OR ((msg.dst_addr)::text ~~ (('380'::text || (mnc.code)::text) || | |
-> Seq Scan on sms_mobilenetworkcode mnc (cost=0.00..1.18 rows=1 width=7) (actual time=0.014..0.042 rows=12 loops=1) | |
Filter: (length((code)::text) = 2) | |
-> Seq Scan on messages msg (cost=0.00..4064.76 rows=88376 width=159) (actual time=0.005..16.282 rows=88382 loops=12) | |
Total runtime: 1064.521 ms | |
(6 rows) |
NewerOlder