Skip to content

Instantly share code, notes, and snippets.

@mizchi
mizchi / Mongo.pm
Created February 18, 2011 05:48
TiarraでMongoDBに投げるモジュール。tiarra/module/Log/Mongo.pm。PerlわからんのでLog::ChannelでDBに投げるピンポイントでコントロール奪ってるだけです。引数も同じにしないと動きません。構成は tiarra - channel - {BSON Column} です。
# -----------------------------------------------------------------------------
# $Id: Mongo.pm 36955 2011-2-18 mizchi $
# -----------------------------------------------------------------------------
package Log::Mongo;
use strict;
use warnings;
use IO::File;
use File::Spec;
use Tiarra::Encoding;
use base qw(Module);
@mizchi
mizchi / to hitode909
Created February 18, 2011 07:45
termtterのエラーログです
[DEBUG] call_hooks: launched #<Termtter::Hook:0xb7415d90 @name=:fetch_my_lists, @points=[:launched], @exec_proc=#<Proc:0xb74202f4@./../lib/plugins/defaults/list.rb:4>>
[DEBUG] rubytter_proxy: lists("mizchi")
[DEBUG] rubytter_proxy: lists("mizchi"), 0.60sec
[DEBUG] call_hooks: [:point => post_lists, :args => ["mizchi"]]
[DEBUG] call_hooks: [:point => post_lists, :args => ["mizchi"]], done
[DEBUG] call_hooks: [:point => launched, :args => []], done
./termtter:15
undefined method `tr' for nil:NilClass
/usr/lib/ruby/gems/1.8/gems/net-irc-0.0.9/lib/net/irc/server.rb:175:in `post'
@mizchi
mizchi / kakaku.py
Created March 10, 2011 01:32
kakaku.com叩く雛形
#!/usr/bin/env python
#-*- encoding:utf-8-*-
import requests
from lxml import etree
base_url = 'http://api.kakaku.com/WebAPI/ItemSearch/Ver1.0/ItemSearch.aspx'
api_key ='<your_api_key>'
def main():
r = requests.get(base_url,
{
#!/usr/bin/env python
#-*- encoding:utf-8-*-
"""
左右どちらから読んでも同じ値になる数を回文数という。 2桁の数の積で表される回文数のうち、最大のものは 9009 = 91 × 99 である。
では、3桁の数の積で表される回文数のうち最大のものはいくらになるか。
"""
def is_reversible(n,side=0):
if n[side] == n[-1-side]:
if len(n)/2 == side:
#!/usr/local/bin/python
# encoding:utf-8
import gdata.calendar
from xml.etree import ElementTree # for Python 2.5 users
import gdata.calendar.service
import gdata.service
import atom.service
import gdata.calendar
import atom
import time
 【基礎演習】
基礎演習 16 2008 春期 2 A
 【統計学】
統計学I 02 2008 春期 2 B
統計学II 02 2008 秋期 2 A+
 【基礎科学】
数学 2010 春期 2 C
@mizchi
mizchi / autobuild.py
Created March 21, 2011 17:15
ファイル監視
#!/usr/local/bin/python
#-*- coding:utf-8 -*-
import os, sys
import commands
import Growl
from time import sleep
from glob import glob
build_command = "./build.sh"
output_dir = "out"
sleep_time = 1
@mizchi
mizchi / faview.py
Created March 24, 2011 13:39
favoriteみる
#/usr/bin/python
#-*- encoding:utf-8 -*-
myname = "mizchi"
ckey = ""
csecret = ""
atoken =""
atoken_secret = ""
t = -0.7975, df = 392.627, p-value = 0.4257
-0.6369035 0.2693129
16.25577 16.43956
t = -2.0701, df = 1750.779, p-value = 0.03859
-0.39904862 -0.01076557
16.25577 16.46067
t = -4.9262, df = 2594.13, p-value = 8.912e-07
-0.5345193 -0.2301443
Factor loadings(rotation:varimax)
Factor1 Factor2 Factor3 Factor4 Factor5
He 0.59083783 0.30320247 0.05948939 0.06676407 -0.12288548
Ne 0.45413847 0.85404182 0.21103665 0.06288825 0.10436213
L Sh 0.89516170 0.36200689 -0.02977188 0.24078232 0.06151326
L El -0.02853584 0.05480893 -0.01784848 -0.02141848 0.99519083
L Ha 0.03189260 0.15493150 0.25957208 -0.19228221 -0.06192143
R Sh 0.23739123 0.58027395 0.03748864 0.07215872 -0.01234576
R El 0.12135670 -0.05174173 0.98415556 0.04428988 -0.08409720
R Ha -0.07703596 0.07336351 0.47721939 0.04857047 0.05988161