This is an example to paginate with bottlepy. To run this,
- install
bottleandbottle_sqlite - run
python db_init.py - run
python bottle_pagination.py
| #!/usr/bin/env python3 | |
| # codin: utf-8 | |
| # memoizing decorator | |
| def memoize(function): | |
| def _memoize(*args, _cache={}): | |
| if args in _cache: | |
| print('return using cached') # just for logging | |
| return _cache[args] |
| # famous | |
| def gcd(a, b): | |
| if b: | |
| return gcd(b, a%b) | |
| return a | |
| # non-recursive | |
| def Gcd(a, b): | |
| while b: | |
| a, b = b, a%b |
| # coding: utf-8 | |
| import sys | |
| import time | |
| from ctypes import windll | |
| user32 = windll.user32 | |
| def detector(keycode=69): |
| ary=(`ls -1 *.*`);for i in $(seq -w `ls -U1 | wc -l`);do;mv $ary[i] $i"."${ary[$i]##*.};done |
| $PREFIXES: null, -moz-, -webkit-; | |
| @mixin prefix($property, $value){ | |
| @each $prefix in $PREFIXES{ | |
| #{$prefix}#{$property}: $value; | |
| } | |
| } |
| #!/bin/sh | |
| # you need to write title in Front Matter of each post like: | |
| # --- | |
| # title: SOME TITLE | |
| # --- | |
| # require: | |
| # https://github.com/shokai/tw | |
| tw_ID="{{ your twitter ID registered in tw }}" | |
| cname="{{ your GitHub Pages' CNAME }}" |
| #!/usr/bin/env python2 | |
| # coding: utf-8 | |
| import re | |
| import time | |
| import logging | |
| import functools | |
| import Skype4Py |
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| import os | |
| import struct | |
| class Image: | |
| def __init__(self, dir='./'): | |
| self.train_files = { |
| GCD = (lambda f: (lambda x: f(lambda y: x(x)(y)))(lambda x: f(lambda y: x(x)(y))))(lambda f: lambda a: lambda b: (lambda L: lambda M: lambda N: L(M)(N))((lambda L: (lambda x: lambda y: x(lambda x: x)) if L else (lambda x: lambda y: y))(b))(lambda g: f(b)(a%b))(a)) |