Skip to content

Instantly share code, notes, and snippets.

ALTER TABLE changeset_comments RENAME TO changeset_comments_old;
CREATE TABLE changeset_comments (
comment_id INTEGER NOT NULL,
repo_id INTEGER NOT NULL,
revision VARCHAR(40),
pull_request_id INTEGER,
line_no VARCHAR(10),
f_path VARCHAR(1000),
user_id INTEGER NOT NULL,
@knzm
knzm / 00-index.txt
Created August 15, 2012 21:50
How to create PDF slide by using Sphinx + xhtml2pdf
- Install xhtml2pdf (former "pisa").
http://www.xhtml2pdf.com/
- Install Takao Font (TakaoPGothic.ttf).
https://launchpad.net/takao-fonts/
- Modify conf.py as below.
- Modify Makefile as below.
[core]
excludesfile = ~/.gitignore
pager = cat
[color]
ui = true
branch = auto
diff = auto
interactive = auto
status = auto
[diff]
from pyramid.config import Configurator
# from pyramid.view import view_config
from .conditional_renderer import view_config
"""
@view_config(route_name="foo", renderer="app1:foo.mako")
def foo(request):
if "success" in request.GET:
return {"message": "success"}
fizzbuzz x
| (mod x 15 == 0) = "FizzBuzz"
| (mod x 3 == 0) = "Fizz"
| (mod x 5 == 0) = "Buzz"
| otherwise = show x
main = print $ take 100 $ map fizzbuzz [1..]
@knzm
knzm / 00-index.rst
Created August 25, 2012 18:19
Run PHP scripts without Apache on Mac

1. Install php-cgi

  • Download PHP542.dmg and open it.
  • Copy PHP5 folder into /Applications.

2. Install WPHP

#!/usr/bin/python3
def primes():
with open("primes1.txt") as f:
f.readline()
f.readline()
for line in f:
for num in line.strip().split():
yield int(num)
#!/usr/bin/python3
import os
import sys
import re
import itertools
import base64
template = '''\
#!/usr/bin/python3
function A(p) {
var obj = function() {
return A(obj);
};
obj.p = p;
return obj;
};
console.log(A());
console.log(A()());
@knzm
knzm / gist:3819405
Created October 2, 2012 14:06
How to reset background at boot in Ubuntu 12.04