sudo apt-get install pandoc
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
require 'formula' | |
class Vim < Formula | |
homepage 'http://www.vim.org/' | |
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2' | |
head 'https://vim.googlecode.com/hg/' | |
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d' | |
version '7.3.189' | |
def features; %w(tiny small normal big huge) end |
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 sqlalchemy import not_ | |
session.query(Region).filter(not_(Region.id.in_( (1,2,3) ))) | |
alternately, | |
session.query(Region).filter(~ Region.id.in_( (1,2,3) )) |
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
# Gemfile | |
… | |
gem 'uuidtools' | |
… |
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
Entry.where(:id => Entry.select('max(id) id').arel).to_sql |
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
## {{{ http://code.activestate.com/recipes/577605/ (r1) | |
# -*- coding:utf-8 -*- | |
def Dict2Str(dictin): | |
# make dict to str, with the format key='value' | |
#tmpstr='' | |
tmplist=[] | |
for k,v in dictin.items(): | |
tmp = str(k)+'='+'\''+str(v)+'\'' | |
tmplist.append(' '+tmp+' ') | |
return ','.join(tmplist) |
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
lang2Name = {'af': 'Afrikaans', | |
'am': 'Amharic', | |
'ar': 'Arabic', | |
'ast': 'Asturian', | |
'az': 'Azerbaijani', | |
'be': 'Belarusian', | |
'be@latin': 'Belarusian (Latin script)', | |
'bg': 'Bulgarian', | |
'bn': 'Bengali', | |
'bn_IN': 'Bengali (India)', |
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
<script type="text/javascript"> | |
function GetQueryString(name) { | |
var reg=new RegExp("(^|&)"+name+"=([^&]*)(&|$)"); | |
var r=window.location.search.substr(1).match(reg); | |
if (r!=null) | |
return unescape(r[2]); | |
return null; | |
} | |
$(document).ready( function() { |
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
"""RSA module | |
Module for calculating large primes, and RSA encryption, decryption, | |
signing and verification. Includes generating public and private keys. | |
http://hg.stuvel.eu/python-rsa/ | |
""" | |
__author__ = "Sybren Stuvel, Marloes de Boer, Ivo Tamboer, and Barry Mead" | |
__date__ = "2010-02-08" |
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 pyDes import * | |
>>> data = 'welcome to china' | |
>>> k = des('DESCRYPT', CBC, '\0\0\0\0\0\0\0\0', pad=None, padmode=PAD_PKCS5) | |
>>> d = k.encrypt(data) | |
>>> print "Encrypted: %r" % d | |
Encrypted: '\x7f\xd0\xdc\x1b\x86Y\xe7\xf2\xcb\xd5 tR\xa9G\x8a>-\x07\xec\xb3)\xce | |
\xa0' | |
>>> print "Decrypted: %r" % k.decrypt(d) | |
Decrypted: 'welcome to china' | |
>>> assert k.decrypt(d, padmode=PAD_PKCS5) == data |