Skip to content

Instantly share code, notes, and snippets.

View wozozo's full-sized avatar
😇
Hello

Yoichi Fujimoto wozozo

😇
Hello
  • Tokyo, Japan
  • 00:16 (UTC +09:00)
  • X @wozozo
View GitHub Profile
@wozozo
wozozo / setup.sh
Created March 21, 2010 16:45
setup
#!/bin/sh
PYTHON_VERSION=2.7.1
# system tools
sudo aptitude update
sudo aptitude safe-upgrade -y
sudo aptitude install build-essential -y
sudo aptitude install zsh-beta tmux tree colordiff -y
sudo aptitude install mysql-server libmysqld-dev sqlite3 -y
var i = 0;
var timer = setInterval(function(){
console.log('first interval: ' + i++);
if (i > 5) {
clearInterval(timer);
setInterval(function(){
console.info('second interval: ' + i++);
},300);
}
PREFECTURE_CHOICES = (
(1, '北海道'), (2,'青森県'), (3,'岩手県'), (4,'宮城県'), (5,'秋田県'),
(6, '山形県'), (7,'福島県'), (8,'茨城県'), (9,'栃木県'), (10,'群馬県'),
(11, '埼玉県'), (12,'千葉県'), (13,'東京都'), (14,'神奈川県'), (15,'新潟県'),
(16, '富山県'), (17,'石川県'), (18,'福井県'), (19,'山梨県'), (20,'長野県'),
(21, '岐阜県'), (22,'静岡県'), (23,'愛知県'), (24,'三重県'), (25,'滋賀県'),
(26, '京都府'), (27,'大阪府'), (28,'兵庫県'), (29,'奈良県'), (30,'和歌山県'),
(31, '鳥取県'), (32,'島根県'), (33,'岡山県'), (34,'広島県'), (35,'山口県'),
(36, '徳島県'), (37,'香川県'), (38,'愛媛県'), (39,'高知県'), (40,'福岡県'),
(41, '佐賀県'), (42,'長崎県'), (43,'熊本県'), (44,'大分県'), (45,'宮崎県'),
def splitquery(params):
"""
>>> params = '/word:hoge+piyo+ +/like:apple/color:white'
"""
queries = {}
for param in params[1:].split('/'):
p = param.split(':')
queries[p[0]] = [s for s in p[1].split('+') if s.strip() != '']
return queries
@wozozo
wozozo / gist:476455
Created July 15, 2010 03:22
FetchFromCacheMiddleware
# encoding: utf-8
from django.conf import settings
from django.core.cache import cache
from django.utils.cache import get_cache_key
class FetchFromCacheMiddleware(object):
"""
Request-phase cache middleware that fetches a page from the cache.
@wozozo
wozozo / buidout.cfg
Created July 19, 2010 04:20
buildout.cfg
[buildout]
parts =
django
library
debug
eggs =
ipython
[library]
recipe = zc.recipe.egg
# coding: utf-8
from multiprocessing import *
import os
import time
class ReiProcess(Process):
def __init__(self, url):
Process.__init__(self)
#!/usr/bin/env python
# $Id: ftpserver.py 629 2009-09-13 20:20:15Z billiejoex $
#
# pyftpdlib is released under the MIT license, reproduced below:
# ======================================================================
# Copyright (C) 2007-2009 Giampaolo Rodola' <g.rodola@gmail.com>
#
# All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person
<?php
print("\033[30mAAAAAAA\033[0m\n");
print("\033[31mAAAAAAA\033[0m\n");
print("\033[32mAAAAAAA\033[0m\n");
print("\033[33mAAAAAAA\033[0m\n");
print("\033[1;34mAAAAAAA\033[0m\n");
print("\033[34mAAAAAAA\033[0m\n");
print("\033[1;35mAAAAAAA\033[0m\n");
print("\033[35mAAAAAAA\033[0m\n");
print("\033[5;7;36mABCDEFG\033[0m\n");
#!/bin/sh
mkdir wozozo
cd wozozo
php -r "file_put_contents('setup.php',file_get_contents('http://rhaco.org/setup.php'));"
php -r "file_put_contents('jump.php',file_get_contents('http://rhaco.org/jump.php'));"
php setup.php -install org.rhaco.contrib.acme.unko
php setup.php -import org.rhaco.net.Runserver
php setup.php -runserver -port 8888