This file contains 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
# -*- encoding: utf-8 -*- | |
import urllib2 | |
import json | |
from lxml import etree | |
import time | |
import memcache | |
mc = memcache.Client(["localhost:11211"]) | |
class MemcacheError(Exception): |
This file contains 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
2009/12/14 | |
## レシピ | |
+ 水に昆布を入れて沸騰する直前で出す | |
+ 削り節を入れて沸騰させたら濾して鍋を変える | |
+ 醤油、みりん、砂糖、鷹の爪少々で味を整える | |
+ 切った大根を鍋に入れ、1時間煮る | |
+ その間に卵をゆでる | |
+ ゆで卵、こんにゃくを鍋に | |
+ 30分煮る | |
+ さつま揚げなどを鍋に |
This file contains 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
# warning! this command stop/start rabbitmq-server. | |
# with no confirmation and approval...! | |
sudo apt-get install ejabberd |
This file contains 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
#bofore | |
sql = "select user,image from users where user in ('%s')" % "', '".join(usernames.keys()) | |
cur.execute(sql) | |
for x in cur.fetchall(): | |
users[x[0]]=x[1] | |
#after | |
import redis | |
rds = redis.Redis(host='localhost', port=PORT, db=1) |
This file contains 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
# -*- coding: utf-8 -*- | |
import sys | |
import urllib | |
import oauth2 as oauth | |
following_url = 'http://twitter.com/statuses/friends.json' | |
consumer_key = '' | |
consumer_secret = '' |
This file contains 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 django import template | |
from django.utils.safestring import mark_safe | |
import re | |
register = template.Library() | |
prefix = ["http://twitpic.com/"] | |
reTwitpic = re.compile("\w*http:\/\/twitpic.com\/(\w+)") | |
@register.filter |
This file contains 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
twitter検索(yats)のメモ: | |
15億つぶやきを日付ソートで検索(100万req/日 solr response avg:170ms) | |
以下の構成が4セット。1億件ずつプロセスを切ったJavaプロセスが起動している。(合計15〜20プロセス) | |
CPU 4core / SSD 160GB / mem 8-16GB | |
高頻度に更新される一部のプロセスのみmaster/slaveになっていて参照をslaveに寄せている。 | |
swapしない限りはプロセスが落ちることはほぼない。最も長いプロセスは3ヶ月以上? | |
こんなスクリプトで起動と終了を管理してる。 | |
http://daveelkins.com/2009/01/13/setting-solr-as-a-daemon-and-monitoring-with-god/ |
This file contains 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 'rubygems' | |
require 'mongo' | |
require 'pp' | |
include Mongo | |
db = Connection.new.db('twitter') | |
profiles = db.collection('profiles') | |
friends = db.collection('friends') | |
pp "find by limit" |
This file contains 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
{"_id"=>BSON::ObjectId('4c72cb941d41c8640e00135a'), | |
"contributors_enabled"=>false, | |
"created_at"=>"Fri Apr 13 00:12:57 +0000 2007", | |
"description"=>"XBL:ecceecce, GameCenter:fuba, クレクレ厨", | |
"favourites_count"=>3523, | |
"follow_request_sent"=>false, | |
"followers_count"=>2693, | |
"following"=>true, | |
"friends_count"=>2629, | |
"geo_enabled"=>true, |
This file contains 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
You can get twitter user_ids who speak japanese. | |
MySQL dump file:deprecated. | |
JSON interface: | |
Query: | |
http://yats-data.com/yats/user_ids?id_autoinc=1260000&page=1 | |
Params: |
OlderNewer