tweepy使用,public streamを垂れ流す

#coding:utf-8

import tweepy
import sys

consumer_key = ''
consumer_secret = ''
access_key = ''
access_secret = ''

class StreamListener(tweepy.StreamListener):
    def on_status(self, status):
        if sys.argv[1].decode('utf-8') in status.text:
            print (status.user.screen_name+' : '+status.text.encode('utf-8'))

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key, access_secret)

stream = tweepy.Stream(auth, StreamListener())
stream.sample()

コピペですが.
http://newbienewbie.wordpress.com/2011/04/16/twitterのstreaming-apiを試してみる/
スクリプトに引数として単語を渡すとそれを含むtweetをpublic streamから拾ってくる.

perlのお勉強

ぼちぼちperlのお勉強をしています.
昨日はshift()等学んだ.

my @a = (0, 1, 2);
print shift(@a)
>>0

shiftは配列を引数にとりその第一要素を返す.
次のような場合は動作が異なる.

sub a {
    my $x = shift // 1; # $xのデフォルト値の設定(引数(shift)がなければ1を代入)
    return $x + 1;
}
print &a();
print "\n";
print &a((0, 1, 2));
>>2
>>1

サブルーチン内で単独でshiftを呼ぶとデフォルトで@_を参照する.

Virtual Box にGuest Additions をインストール {ホスト:Win7,ゲスト:Ubuntu}

デバイス(D) → Guest Additions のインストール
で駄目だった.

mount自体はしてるみたいなので見に行く.

cd /media/cdrom0
vim AUTORUN.INF

どうやらオートランがWindows OS 用のプログラムを参照してるらしいのでLinux 用を直接起動.

sudo ./VBoxLinuxAdditions.run

なんか色々出て終了 → リブート