2009-01-01から1年間の記事一覧
ほぼ日乗組員が紹介する、ほぼ日手帳2010 同じ内容です。Youtubeから埋め込みタグをもってきて 貼付けたのがこちら。こっちの方が画面が広くていいですね。
水などが不足している地域の番組を見たとき、 「大変そうだなー、重そうだなー」とか思うだけではなくて、 どうやったら楽にできるかなっていうことを考えたい。 その思考にジャンプするのは、そんなに大変ではないと思うから。
私は頭の中のメモリーが少ないのかもしれない。 つまり、並列処理が苦手だ。 1つの処理をやっていても、 別の仕事が気になってしまう。 逆に、1つのことだけに集中すればいい 単純な状況に置かれたときは、 私はうまく振る舞えてきたように思う。 CPUでい…
>>> from PIL import Image >>> im = Image.open('img.jpg') >>> im.size (209, 146) >>> box = (40, 20, 160, 120) >>> im2 = im.crop(box) >>> im2.show() >>> im2.save('img2', 'JPEG')
from PIL import Image import glob, os size = 128, 128 for infile in glob.glob("*.jpg"): file, ext = os.path.splitext(infile) im = Image.open(infile) im.thumbnail(size, Image.ANTIALIAS) im.save(file + ".thumbnail", "JPEG")pythonの画像ライブ…
ニコニコ動画で生放送していた人w
pythonモジュールturtleで描画ができる。 人工知能の移動の可視化とかにいいかも。
python 2.5 以上は、 >>> import hashlib >>> hashlib.md5('text').hexdigest() '1cb251ec0d568de6a929b520c4aed8d1' >>> hashlib.sha1('text').hexdigest() '372ea08cab33e71c02c651dbc83a474d32c676ea' sha224, sha256, sha384, sha512もある。
def hoge(*arg): for x in arg: print x def foo(): ret = [1,2,3] # これは配列ね return tuple(ret)
i, a, oなどを押すことで文章を書くモードに入ります。 ESCを押すと移動やコピーなど、別のモードに入ります。 ESCを押した状態での移動はhjklで行います。 手をほとんど動かさずに移動ができます。 0で文頭、$で文末に移動します。 wで次の単語の先頭へ、…
ニコニコ動画で洋楽がランダムジャンプでつながっていく。 作業用BGMにおすすめ。 http://www.nicovideo.jp/mylist/14529604 英語や日本語訳をコメントでのせてくれている人がいるが、 全部歌いきる前にコメントが消えてしまうことが多い。 コメントの表示時…
http://vision.stanford.edu/publications.html
a = 0 or 1 a = 1-a a ^= 1
generative model learn class-conditional densities and learn priors and finally use bayes theorem discriminative model directly learn posterior probabilities
NumPy for R (and S-Plus) users http://mathesaurus.sourceforge.net/r-numpy.html
>>> a [1, 2, 3] >>> b [4, 5, 6] >>> A = numpy.array(a) >>> B = numpy.array(b) >>> d2 = numpy.power(A-B, 2).sum() >>> d2 27 >>> d2 = numpy.power(A-B, 2) >>> d2 array([9, 9, 9]) >>>
geditでoctaveコードを書いても、 .mだとobjective-cだと思ってしまうので うまくハイライトできない。 langファイルを見てみるとoctave用の 設定はあるみたいなので、 objc.langをtempファイルに移動させたら octave.langが使われるようになって 思い通りに…
>>> for i in xrange(200): ... print i, chr(i) ... 上のコードをpythonで実行してできた文字列を はてブのcode記法に入れたら その日の日記すべての日本語がバグった。 上の記事の日本語部分を書き直すはめになった。 上で使っているchr()は文字コードから…
>>> import sys >>> print sys.getrefcount.__doc__ getrefcount(object) -> integer Return the reference count of object. The count returned is generally one higher than you might expect, because it includes the (temporary) reference as an arg…
>>> L1 = [1,2,3] >>> L2 = [4,5,6] >>> zip(L1, L2) [(1, 4), (2, 5), (3, 6)] >>> dict(zip(L1,L2)) {1: 4, 2: 5, 3: 6}
>>> L = range(10) >>> L[::2] [0, 2, 4, 6, 8] >>> L[:] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> L[::] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> L[::3] [0, 3, 6, 9]
FF13 trailerをニコニコ動画で見ていて、 自分のブログに動画を貼付けるボタンを発見。 貼付けURLが表示されるんだろうな、と思っていたら、 それに加えて「ブログサービスを選択」っていうボタンもある。 そこではてなダイアリーを選んでボタンを押したら、…
ランキングも見やすくなっていますね。
I arrange figures generated by "python google chart". (helper.py is needed) labels.py line.py ? ? mapchart.py ? pie.py qrchart.py ? scatter.py venn.py
Google chart is useful. It is used through python. I introduce how to use. bar.py #!/usr/bin/env python """ Copyright Gerald Kaszuba 2008 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Ge…
この記事はDiggでgame developmentで検索して見つけた最近の記事です。 日本語を挿入していきます。 英語の勉強にもなるので、一石二鳥です。 (kill two birds with one stone) Intel is back, pitching its processors for gaming graphics. インテルが、ゲ…
def getServerName( url=URL ): ''' URLを与えたらサーバ名を文字列で返す ''' import urllib url = url.rstrip() site = urllib.urlopen( url ) info = site.headers infostr = str(info) sep = infostr.split('\n') for s in sep: if 'Server:' in str(s):…
telnetのGETに対応する動作。 import urllib con = urllib.urlopen("http://rem.bake-neko.net/") print con.geturl() #URL print con.read() #html print con.headers #Serverなど参考
ここで言う「片思い」とは、 あなたがfollowしているのに 相手はfollowしていない人をさします。 そういう人をまとめてfollowからはずすPythonコード をここに書きます。 python twitterを導入している環境なら動くはずです。 Ubuntu Linuxで動作確認済みで…