This file contains hidden or 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
| tf-idf | |
| map-reduce-browser: http://www.igvita.com/2009/03/03/collaborative-map-reduce-in-the-browser/ | |
| svm-in-ruby: http://www.igvita.com/2008/01/07/support-vector-machines-svm-in-ruby/ |
This file contains hidden or 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
| rd, wr = IO.pipe | |
| if fork | |
| wr.close | |
| puts "Parent got: <#{rd.read}>" | |
| rd.close | |
| Process.wait | |
| else | |
| rd.close | |
| puts "Sending message to parent" |
This file contains hidden or 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
| =========================== | |
| #a.rb | |
| require 'forkoff' | |
| def run(i) | |
| sleep rand | |
| [i,i*i]*":" | |
| end | |
| def m(d) | |
| d.forkoff(200){|i|run(i)} |
This file contains hidden or 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
| FriendFeed Implements Schema-less Storage Atop MySQL | |
| http://www.infoq.com/news/2009/03/friendfeed-schemaless-mySQL |
This file contains hidden or 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
| class Entity < ActiveRecord::Base | |
| serialize :body | |
| belongs_to :resource,:polymorphic => true | |
| end | |
| class Report < ActiveRecord::Base | |
| has_one :entity,:as=>:resource | |
| end | |
| class Post < ActiveRecord::Base | |
| has_many :entities, :as=>:resource | |
| end |
This file contains hidden or 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
| class Module | |
| def field(*args) | |
| args.each do |m| | |
| class_eval do | |
| define_method("#{m}="){|a| | |
| instance_variable_set("@#{m}",a) | |
| } | |
| define_method("#{m}"){ | |
| instance_variable_get("@#{m}") | |
| } |
This file contains hidden or 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
| <?php | |
| declare(ticks = 1); | |
| $max=5; | |
| $GLOBALS[__FILE__]['_child']=0; | |
| //print_r($GLOBALS);exit; | |
| // function for signal handler | |
| function sig_handler($signo) { | |
| switch ($signo) { |
This file contains hidden or 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
| <?php | |
| declare (ticks=1); // Be sure that each signal is handled when it is received. | |
| ini_set("max_execution_time", "0"); // Give us eternity to execute the script. We can always kill -9 | |
| ini_set("max_input_time", "0"); | |
| set_time_limit(0); | |
| $GLOBALS['mtd_main_thread_pid']=posix_getpid(); | |
| $GLOBALS['child'.$GLOBALS['mtd_main_thread_pid']] = 0; | |
| function mtd_sig_handler($signo) { |
This file contains hidden or 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 'openssl' | |
| data=`echo 'quit'|openssl s_client -connect google.com:443 2> /dev/null &` | |
| cert = OpenSSL::X509::Certificate.new(data) | |
| ms=cert.methods-Object.methods | |
| ms=ms-ms.grep(/=|to|public_key/) | |
| puts ms.map{|m|[m,(cert.send(m) rescue nil)]}.select{|a,b|!b.nil?} |
This file contains hidden or 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
| AD | |
| AE | |
| AF | |
| AG | |
| AI | |
| AL | |
| AM | |
| AN | |
| AO | |
| AQ |
OlderNewer