2008-11-01ãã1ã¶æéã®è¨äºä¸è¦§
#!/usr/bin/env ruby puts 'backup start' hosts = { 'shokai.org'=>'username1', 'zanmai.com'=>'username2' } hosts.each{ |host, user| puts "...sync with #{user}@#{host}..." puts `rsync --progress -t -z #{File.dirname(__FILE__)}/* #{user}@#{hosâ¦
followerã®ã¡ã¼ã«éç¥ãæ¼ãã¦ãããããªæ°ãããã®ã§ãfollowãå¿ãã¦ãã人ã調ã¹ã basicèªè¨¼ã¯open-uri㧠open(http://zanmai.com/asdfasdf, :http_basic_authentication => [@user, @pass]) ããããã¨å ¥ãã twitter-follower-following-diff.rb #!/usâ¦
method(:é¢æ°å).call(å¼æ°)ã¨ã·ã³ãã«ã§æ¸¡ããã®ã ã¨æã£ã¦ããã©ãstringã§é¢æ°åã渡ãã¦ãããã > o = Object.new => #<Object:0x1cea8f0> >> o.methods => ["inspect", "pretty_print_inspect", "to_yaml", "taguri=", "clone", "method", "public_methods", "instance_v</object:0x1cea8f0>â¦
http://d.hatena.ne.jp/shokai/20081126/1227721485 ã®ç¶ããSimpleConsoleã§æ軽ã«ä½¿ãã1è¡ã¡ã¢å¸³ãä½ã£ã http://www.bitbucket.org/shokai/mem/overview/ ã³ãã³ãå¼æ°ããControllerãé¸ãã§Viewã«æµãããã¿ã¯SimpleConsoleãä½ã£ã¦ãããã®ã§ãmodelâ¦
~/.config-test # .config-test # please fill in fields # # name: your-name # mail: [email protected] # name: shokai mail: [email protected] ~/.config-yamlãèªããç¡ããã°ãã³ãã¬ã¼ããä½ã require 'yaml' @@template = <
ãã£ã¡ãmacã®python2.5ç¨ã®sslã® sudo port install py25-socket-sslããã§httpsã«pushã§ãã python-sslã®æ¹ã¯python2.4ç¨ï¼
Rubyã®ã³ã³ã½ã¼ã«ã¢ããªä½æãã¬ã¼ã ã¯ã¼ã¯ã使ã SimpleConsole - Building Console Apps æºè¶³ããè±ãç ãããªããã:ã³ã³ã½ã¼ã«ã¢ããªã±ã¼ã·ã§ã³ç¨ Ruby ãã¬ã¼ã ã¯ã¼ã¯ SimpleConsole ã使ã£ã¦ã¿ã sudo gem install simpleconsoleSuccessfully installeâ¦
sudo apt-get install git-core which git[core] excludesfile = /home/user/.gitignore ãã/home/sho/.gitconfig ç·¨é [core] excludesfile = /home/sho/.gitignore /home/sho/.gitignore *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store *.sw[po] tâ¦
http://d.hatena.ne.jp/n9d/20080331/1206945041 ãè¦ããã¯ã³ã©ã¤ãã¼ä½ããããªã£ãã ruby -e 'dirs = Dir::entries("./"); for dir in dirs; puts dir.gsub(/_/, " ") end;' ã¡ãã£ã¨å¿ è¦ã ã£ãã®ã§åãã¦æ¸ãããzshã®histroyã«å ¥ã£ã¦ããã®ã§ç¢ºãã«ä¾¿â¦
æè¿ãä¿®è«ã®ããã«ãã¼ã¯ã¼ãæ¤ç´¢ãã¦ã¾ã¨ãã¦ãã¦ã³ãã¼ããã¦ããè«æãªã©ãã¡ã¤ã«ãããããªãã£ããæ¶ãã¦ããããã®ã¯å¥ã®ãã£ã¬ã¯ããªã«ç§»åããã¦é¸å¥ãã¦ãããè«æ50åé¸å¥ãçµããã¾ã§éä¸ããããã®ã¯ã³ã©ã¤ãã¼ä½ã£ãã 50åé¸å¥ãããgrowlã§â¦
sudo gem install rfeedfinder feed-normalizer opml
~/.profileãç·¨é export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:$PATH macportsã§ã¤ã³ã¹ãã¼ã« sudo port install pTeX dvipdfmx ghostscript ghostscript-fonts-hiragino which platex-utf8 which dvipdfmxhttp://d.hatena.ne.jp/shokai/200â¦
http://member.zebo.com/Main?event_key=USERSEARCH&action=ns&keyword=car&tab=review&rPage=1http://reviews.zebo.com/nissan/car?breaker=2
p.49ãããHTMLã®è§£æã pythonã§ã¯Beautiful Soupã使ã£ã¦HTMLã解æãã¦ããããRubyãªã®ã§Hpricotã使ããhpricotã¯æ¢ã«3ç« åºç¤ã§HTMLã¿ã°é¤å»ã«ã使ã£ãããä»åã¯ã¿ã°ã®ä¸èº«ãåãåºãã«æ·±å ¥ããã¦ããã 3ç« ãã®2 - æ©æ¬è©³è§£ pylori*style wiki - HTMâ¦
return list.uniqã ã£ãæãä¿®æ£ http://www.bitbucket.org/shokai/collective-intelligence-study/src/tip/03/generatefeedvector-jp.rb def getWordsByKind(node, kind) list = Array.new while node do f = node.feature.split(/,/) if /#{kind}/ =~ f[0]â¦
æ¥æ¬èªãã¼ã¿ãæ±ããªããããã¹ããã¡ã¤ã«ãããªãã¦ã¡ããã¨RDBã«ä¿åããæ¹ãè¯ãã§ãããåºåãæåã¨ããé¢åãããã¦ãã¦ãä»åã¯ã¯ãã¼ã«ãã¦ãããã¼ã¿ã®ä¸é¨ãæåã§ä¿®æ£ãã¦ãã¾ã£ãã ã§ãããâ大ãããµã¤ãº http://www.flickr.com/photos/shokaiâ¦
ãã¼ã¿ç¾¤ãKåã®ã¯ã©ã¹ã¿ã«åããããã«ãããã¡ã°ããã£ããæ¥ãKåã®éå¿ããå帰ã§è¦ã¤ããKå¹³åæ³ã使ãã ãã®ãã¼ã¸ã®ã¤ã³ãã³ããããã¥ããã¦ã¤ã©ã¤ã©ããã ãã®ã¢ã«ã´ãªãºã ã¯é層çã¯ã©ã¹ã¿ãªã³ã°ããå ¨ç¶éãã p.47~48ãã clusters.rbã«kclustâ¦
p.47ã§Kå¹³åæ³ããã£ã¦ãã¦ã2次å é åï¼é åã®é åï¼ãå¿ è¦ã«ãªã£ãã ã«ã¼ãã§ç©ºã®é åãä½ã£ã¦ããã bestmatches = [[] for i in range(4)] Rubyã ã¨ãArray.newã®å¼æ°ã§è¦ç´ æ°ã¨åæå¤ãæå®ã§ãã >> arr = Array.new(3, 10) # è¦ç´ æ°3ã§åæå¤10ã®é â¦
sudo apt-get install libmagick9-dev libmagick++9-dev imagemagick sudo gem install rmagick gemããã®rmagickã¤ã³ã¹ãã¼ã«ã§ããã Building native extensions. This could take a while... ERROR: While executing gem ... (Gem::Installer::Extensionâ¦
rsync -t -r -z ~/src/ruby/collective/ [email protected]:~/src/ruby/collective/éã«ããã¨sshçµç±ã§åã£ã¦ããã
sudo port search gitcogito devel/cogito 0.18.2 Git core and cogito tools to provide a fully-distributed SCM git-core devel/git-core 1.5.5.1 The stupid content tracker. stgit devel/stgit 0.14.1 Push/pop utility on top of GIT cgit www/cgit 0â¦
p.42~44ãããblogã¯ã©ã¹ã¿ã®å³ãæãã Python Imaging Libraryã®ä»£ããã«ãRMagick http://d.hatena.ne.jp/shokai/20081112/1226502119 ã使ãã使ãæ¹ãé¢æ°åãã»ã¼åããªã®ã§ç°¡åããã¨é åå ã®ä¸çªå¤§ããè¦ç´ ãè¿ãArray.maxé¢æ°ã使ã£ãã http://wwwâ¦
3ç« ã§ã¯ãhclusteré¢æ°(http://d.hatena.ne.jp/shokai/20081112/1226473410)ã®å¦çãMacbookã ã¨3åããããããã®ã§ãä½åº¦ããããããªãã ã§ãhclusteré¢æ°ã§ä½ã£ãé層çã¯ã©ã¹ã¿ããã¸ã¥ã¢ã©ã¤ãºããå¦çã¯ä½åº¦ã試è¡é¯èª¤ãããã®ã§ãirbã®loadãç´ããâ¦
convertã³ãã³ããå¢ãã¦ã convert -size 100x80 -font '/Library/Fonts/Arial.ttf' label:"AA\nA" label.pngç»åä½ãã
p.44ãã clusters.rbã«è¡åå転ã追å # è¡åã®å ¥ãæ¿ã def rotatematrix(data) newdata = Array.new for i in 0...data[0].length newrow = Array.new for j in 0...data.length newrow.push(data[j][i]) end newdata.push(newrow) end return newdata enâ¦
ååä»ãå¼æ°ãã¤ã³ã¯ãªã¡ã³ãã ã¨åéããã¦ãã printclust(clust.left, labels=labels, n=n+1) ã®n=n+1ã¯pythonã§ã¯ååä»ãå¼æ°ãªã®ã§ãå¥ã«ã¤ã³ã¯ãªã¡ã³ããã¦ãããããããªãã£ãã cluster.rbã«printclusté¢æ°ã追å http://www.bitbucket.org/shokaâ¦
åèªåºç¾åæ°ã®ãªã¹ããè¦ç´ (vec)ã«æã¤2åæ¨ãã¼ãbiclusterãã¤ãªããããã¦ãp.36ã§è§£èª¬ããã¦ããå 容ãè¿ãblogå士ã®é層çã¯ã©ã¹ã¿ãä½ããè·é¢ã®è¨ç®ã¯é¢æ°ãã¤ã³ã¿ã«ãªã£ã¦ããã®ã§ãObject#methodé¢æ°ã使ã£ã¦ http://www.ruby-lang.org/ja/man/htâ¦
ã¤ã³ã¹ãã¼ã« sudo port install zsh /etc/shellsãç·¨é # List of acceptable shells for chpass(1). # Ftpd will not allow users to connect who are not using # one of these shells. /bin/zsh /bin/bash /bin/csh /bin/ksh /bin/sh /bin/tcshchsh㧠/bâ¦
p.39ã®hclusteré¢æ°ã® distances = {} if(clust[i].id,clust[j].id) not in distances: distances[(clust[i].id,clust[j].id)] = distance(clust[i].vec,clust[j].vec) ããã¾ãã¡ããããªãã£ããã ãã©ãããè¦ãããªã¹ãããã¼ã«ã¨ããã£ã¯ã·ã§ããªï¼ããâ¦
pinMode(0, true); serialInit(2400); // éä¿¡é度é ã function onSerialReceive(success){ data = serialRead(); for(i = 0; i < data.length; i++){ c = data.charAt(i); // 1æåãã¤å¦ç switch(c){ case "a": digitalWrite(0,true); break; case "b": â¦