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
(^o^)/owata |
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 'serialport' | |
sp = SerialPort.new("COM6", 9600, 8, 1, SerialPort::NONE) | |
command = ["0D"] | |
sp.write(command.pack("H*")) | |
sp.read | |
sp.read | |
loop { |
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
int analogValue = 0; | |
void setup() { | |
Serial.begin(9600); | |
} | |
void loop() { | |
analogValue = analogRead(0)/4; | |
Serial.println(analogValue, DEC); | |
delay(100); | |
} |
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
#define R 5 | |
#define G 6 | |
#define B 7 | |
#define S 2 | |
#define WAIT 500 | |
int inByte = 0; | |
int inSwitch; | |
bool r, g, b, blink, off; |
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" | |
gem "activeresource" | |
require "active_resource" | |
require "serialport" | |
class State < ActiveResource::Base | |
self.site = 'http://cyberia.yuiseki.net/' | |
end | |
#5秒おきにRailsに問い合わせて出力する |
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
_,,....,,_ _人人人人人人人人人人人人人人人_ | |
-''":::::::::::::`''> ゆっくりした結果がこれかよ!!! < | |
ヽ::::::::::::::::::::: ̄^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^ ̄ | |
|::::::;ノ´ ̄\:::::::::::\_,. -‐ァ __ _____ ______ | |
|::::ノ ヽ、ヽr-r'"´ (.__ ,´ _,, '-´ ̄ ̄`-ゝ 、_ イ、 | |
_,.!イ_ _,.ヘーァ'二ハ二ヽ、へ,_7 'r ´ ヽ、ン、 | |
::::::rー''7コ-‐'"´ ; ', `ヽ/`7 ,'==─- -─==', i | |
r-'ァ'"´/ /! ハ ハ ! iヾ_ノ i イ iゝ、イ人レ/_ルヽイ i | | |
!イ´ ,' | /__,.!/ V 、!__ハ ,' ,ゝ レリイi (ヒ_] ヒ_ン ).| .|、i .|| | |
`! !/レi' (ヒ_] ヒ_ン レ'i ノ !Y!"" ,___, "" 「 !ノ i | |
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
#!/usr/local/bin/ruby -Ks | |
# _*_ coding: utf-8 _*_ | |
require 'rubygems' | |
require 'mechanize' | |
require 'time' | |
MAIL = 'mixi_login_mail_address' | |
PASS = 'mixi_login_pass' | |
DIRECTORY = 'log_directory_path' |
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 'sinatra' | |
require 'tokyotyrant' | |
include TokyoTyrant | |
helpers do | |
def get_recents() | |
rdb = RDBTBL::new | |
rdb.open('localhost', 1978) | |
qry = RDBQRY::new(rdb) |
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
1.text 型で :data というカラムを持った Async というモデルを作る。 | |
2.アプリケーションから非同期になにかやりたい時は {:method => 処理の名称, :args => 引数} みたいな感じのハッシュを JSON 化して Async のインスタンスを create する | |
3.Async の中身を見て、何かあったら :method の処理に :args の引数を渡して走らせ、終ったら対象を destroy するというメソッドをどっかに作って cron で ./script/runner 経由で回す |
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
# とりあえずsocial streamの埋め込みページからスクレイピングで検索条件を特定する | |
from BeautifulSoup import BeautifulSoup | |
stream = "http://www.ustream.tv/socialstream/%s" % channel_id | |
html = urllib.urlopen(stream) | |
soup = BeautifulSoup(html.read()) | |
scripts = soup.findAll('script') | |
# scriptタグのUstream.Vars.messageSuffix=" (#akibaust live at http:\/\/ustre.am\/kpMv )"というあたりの文字列 | |
suffix = scripts[2].string.split(';')[8] | |
# #akibaust というあたりの文字列 |
OlderNewer