This file contains hidden or 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
virtualenv --no-site-packages . | |
source bin/activate | |
bin/pip install Django psycopg2 django-sentry | |
bin/pip freeze > requirements.txt | |
bin/django-admin.py startproject mysite | |
cat >.gitignore <<EOF | |
bin/ | |
include/ | |
lib/ | |
EOF |
This file contains hidden or 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
%!TEX TS-program = xelatex | |
\documentclass[12pt]{scrartcl} | |
% The declaration of the document class: | |
% The second line here, i.e. | |
% \documentclass[12pt]{scrartcl} | |
% is a standard LaTeX document class declaration: | |
% we say what kind of document we are making in curly brackets, | |
% and specify any options in square brackets. |
This file contains hidden or 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
" folding for Markdown headers, both styles (atx- and setex-) | |
" http://daringfireball.net/projects/markdown/syntax#header | |
" | |
" this code can be placed in file | |
" $HOME/.vim/after/ftplugin/markdown.vim | |
func! Foldexpr_markdown(lnum) | |
let l1 = getline(a:lnum) | |
if l1 =~ '^\s*$' |
This file contains hidden or 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
javascript:(function({ | |
var INSTAPAPER=true,w=window,d=document,pageSelectedTxt=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0),pageTitle=d.title,pageUri=w.location.href,tmplt=""; | |
tmplt="From ["+pageTitle+"]("+pageUri+"):\n\n"; | |
if(pageSelectedTxt!="") { | |
pageSelectedTxt=">%20"+pageSelectedTxt; | |
pageSelectedTxt=pageSelectedTxt.replace(/(\r\n|\n+|\r)/gm,"\n"); | |
pageSelectedTxt=pageSelectedTxt.replace(/\n/g,"\n>%20\n>%20"); | |
w.location.href="nvalt://make/?txt="+encodeURIComponent(tmplt+pageSelectedTxt)+"&title="+encodeURIComponent(pageTitle) | |
} | |
else { |
This file contains hidden or 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
javascript:(function(){ | |
var enc=encodeURIComponent, | |
w=window, | |
frames=w.frames, | |
d=document, | |
tn=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0), | |
pu=w.location.href, | |
isGMail=w.location.host.match(/mail\.google\.com/), | |
tt=pt=d.title, | |
subjSpans=d.getElementsByClassName("hP"),i,url; |
This file contains hidden or 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
" tmux will only forward escape sequences to the terminal if surrounded by a DCS sequence | |
" http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinkbdoZ8eNR1X2UobLTeww1jFrvfJxTMfKSq-L%2B%40mail.gmail.com&forum_name=tmux-users | |
if exists('$TMUX') | |
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" | |
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\" | |
else | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" | |
endif |
This file contains hidden or 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
curl -X GET 'http://localhost:9200/articles/_search?search_type=count&pretty=true' -d \ | |
'{ | |
"query" : { | |
"match_all" : {} | |
}, | |
"facets" : { | |
"by_hour" : { | |
"range" : { | |
"key_script" : "doc[\"published_on\"].date.hourOfDay", | |
"value_script" : "1", |
This file contains hidden or 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
HOST='http://localhost:9200' | |
INDEX='articles' | |
curl -s -X DELETE "$HOST/$INDEX" -o /dev/null | |
curl -s -X POST "$HOST/$INDEX/article" -d '{ "t" : "1", "published" : "2010-01-01T02:20:00" }' -o /dev/null # fri | |
curl -s -X POST "$HOST/$INDEX/article" -d '{ "t" : "2", "published" : "2010-01-02T02:20:00" }' -o /dev/null # sat | |
curl -s -X POST "$HOST/$INDEX/article" -d '{ "t" : "3", "published" : "2010-01-02T08:40:00" }' -o /dev/null # sat | |
curl -s -X POST "$HOST/$INDEX/article" -d '{ "t" : "4", "published" : "2010-01-03T08:10:00" }' -o /dev/null # sun | |
curl -s -X POST "$HOST/$INDEX/article" -d '{ "t" : "5", "published" : "2010-01-04T16:20:00" }' -o /dev/null # mon | |
curl -s -X POST "$HOST/$INDEX/article" -d '{ "t" : "6", "published" : "2010-01-04T16:40:00" }' -o /dev/null # mon |
This file contains hidden or 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
in the: ************************************* (3765) | |
i love: *************************** (2781) | |
to be: ************************** (2637) | |
of the: ********************* (2150) | |
if you: ********************* (2150) | |
on the: ******************** (2081) | |
i just: ****************** (1838) | |
i was: ****************** (1829) | |
i don't: ****************** (1825) | |
i have: ****************** (1802) |
This file contains hidden or 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
"""" | |
Required: fabric, django, coverage, django-coverage, termcolor | |
"""" | |
from coverage.misc import CoverageException | |
from termcolor import colored | |
def coverage(html=1): | |
"""Run coverage tests with html output, or | |
or return only the coverage percentage:: |