Skip to content

Instantly share code, notes, and snippets.

@knzm
knzm / dl_tia_list.py
Created May 8, 2011 14:29
Download comitia (http://www.comitia.co.jp/) circle list.
# -*- coding: utf-8 -*-
import logging
import urllib
import lxml.html
log = None
list_url = "http://www.comitia.co.jp/history/96list.html"
(function() {
var d = true, e = false;
try {
if (!google.doodle)
google.doodle = {};
var f, g, j,
k = navigator.userAgent.indexOf("MSIE") >= 0,
o = {
"logo-blockheads": {
k: "blockheads.jpg",
#hplogo {
height: 230px;
margin: 0 auto;
overflow: hidden;
position: relative;
width: 450px
}
#logo-blockheads, #logo-blockheads-hold, #logo-goo, #logo-goo-hold, #logo-gumby, #logo-gumby-hold, #logo-gumby-loop, #logo-pokey, #logo-pokey-hold, #logo-prickle, #logo-prickle-hold {
cursor: pointer;
position: absolute
<div id=hplogo>
<div id=logo-gumby-hold></div>
<div id=logo-gumby></div>
<div id=logo-gumby-loop></div>
<div id=logo-blockheads-hold></div>
<div id=logo-blockheads></div>
<div id=logo-prickle-hold></div>
<div id=logo-prickle></div>
<div id=logo-goo-hold></div>
<div id=logo-goo></div>
import socket
import re
import urllib
socket.setdefaulttimeout(5)
def get_content(url):
try:
f = urllib.urlopen(url)
except IOError:
@knzm
knzm / gist:1299289
Created October 19, 2011 18:53
How to recover grub boot loader on MacBook Air
# Boot from Live CD
root@ubuntu:~# dmesg | grep DMI
[ 0.000000] DMI 2.4 present.
[ 0.000000] DMI: Apple Inc. MacBookAir1,1/Mac-F42C8CC8, BIOS MBA11.88Z.00BB.B03.0803171226 03/17/08
root@ubuntu:~# mount --bind /dev /mnt/dev
root@ubuntu:~# mount --bind /sys /mnt/sys
root@ubuntu:~# mount -t proc none /mnt/proc
root@ubuntu:~# chroot /mnt /bin/bash
@knzm
knzm / gist:1306187
Created October 22, 2011 16:40
How to downgrade EMGD X server on Natty VAIO Type P
1. disable LP-PPA-gma500-emgd/ubuntu repository
2. create /etc/apt/preferences.d/xorg with the following content
Package: *
Pin: release o=Ubuntu
Pin-Priority: 1001
Package: *
Pin: release o=LP-PPA-gma500-emgd
import transaction
from hgwiki import models
from hgwiki.security import make_digest
default_users = [
("pyramid", "pylons")
]
def setup(env):
@knzm
knzm / README.txt
Created November 8, 2011 16:39
Jython + Servlet + WSGI + XML-RPC memo
INSTRUCTIONS
1. Put web.xml at /usr/share/tomcat6/webapps/jython_xmlrpc/WEB-INF/web.xml
2. Put jython.jar and servlet-api-2.4.jar at /usr/share/tomcat6/webapps/jython_xmlrpc/WEB-INF/lib/
3. Put index.wsgi at /usr/share/tomcat6/webapps/jython_xmlrpc/index.wsgi
4. Download http://pypi.python.org/pypi/wsgi-xmlrpc/ and unpack, then put wsgi_xmlrpc directory at /usr/share/tomcat6/webapps/jython_xmlrpc
5. Restart your tomcat server
@knzm
knzm / gist:1360823
Created November 12, 2011 17:07
blockdiag shorturl issue inspection
Flow analysis
==============
in compress::
diagram = Base64.encodeURI('\x78\x9c' + RawDeflate.deflate(diagram) + adler32(diagram));
in decompress::
source = Base64.decode(source)