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
from datetime import datetime, timedelta | |
import functools | |
import pickle | |
def days_ago(days): | |
dt = datetime.now() - timedelta(days=days) | |
return dt.strftime('%y%m%s') | |
print pickle.dumps(functools.partial(days_ago, 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
" Taglist integration | |
let Tlist_Process_File_Always = 1 | |
" statusline config | |
set laststatus=2 | |
set statusline= | |
set statusline+=%< " cut at start | |
set statusline+=%f " relative path | |
set statusline+=\ -\ %{Tlist_Get_Tagname_By_Line()} " taglist |
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
o = type('anonymous', (object,), {'attr_1': 'value_1', 'attr_2': 'value_2'}) | |
print o.attr_1, o.attr_2 |
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
#!/bin/bash | |
git log --graph --pretty="format:%C(yellow)%h%Cgreen%d%Creset %s %C(cyan) - %an, %Cred%ar%Creset" |
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
{ | |
'subtotal_price': Decimal('38.0'), | |
'buyer_accepts_marketing': True, | |
'shipping_lines': [{ | |
'source': 'shopify', | |
'price': Decimal('10.0'), | |
'code': 'Standard Shipping', | |
'title': 'Standard Shipping' | |
}], | |
'cart_token': None, |
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
# Fuck off httplib2 reporting failed SSL cert verification. | |
import httplib2 | |
import certifi | |
httplib2.CA_CERTS = certifi.where() |
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
" Smart indenting for Python | |
autocmd FileType python set smartindent | |
autocmd FileType python set cinwords=if,elif,else,for,while,try,except,finally,def,class | |
autocmd FileType python set tabstop=4 | |
autocmd FileType python set shiftwidth=4 | |
autocmd FileType python set expandtab |
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
#!/usr/bin/env bash | |
sudo smtp-sink -R /tmp -u root -d "mail.%Y-%m-%dT%H%M." 127.0.0.1:25 1024 |
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
#!bash | |
# | |
# Enable file/directory completion for git. | |
# | |
# bashref - http://is.gd/PHQRX1 | |
# bashlib - http://code.google.com/p/bash-completion-lib/ | |
have git && { | |
_git_completion() | |
{ |
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
#!/usr/bin/env python | |
# Usage: urldecode.py url | |
import urllib | |
import sys | |
print urllib.unquote_plus(sys.argv[1]) |