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
irb(main):001:0> require 'serialport' | |
=> true | |
irb(main):002:0> port_str = "/dev/tty.usbserial-A6007bRb" | |
=> "/dev/tty.usbserial-A6007bRb" | |
irb(main):003:0> baud_rate = 2400 | |
=> 2400 | |
irb(main):004:0> data_bits=8 | |
=> 8 | |
irb(main):005:0> stop_bits=1 | |
=> 1 |
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
>> n = 50_000 | |
=> 50000 | |
>> Benchmark.bm do |x| | |
?> x.report { n.times do; "abc".concat(35); end} | |
>> x.report { n.times do; "abc" + 35.to_s; end} | |
>> end | |
user system total real | |
0.020000 0.000000 0.020000 ( 0.023788) | |
0.140000 0.000000 0.140000 ( 0.132843) | |
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 'rubygems' | |
=> false | |
>> require 'benchmark' | |
=> false | |
>> require 'yaml' | |
=> false | |
>> Benchmark.bmbm do |x| | |
?> x.report("yaml") { 100_000.times do ; ary = [1,2,3,4,5]; YAML.load(ary.to_yaml); end} | |
>> x.report("marshal") {100_000.times do ; ary = [1,2,3,4,5]; Marshal.load(Marshal.dump(ary)); end} | |
>> 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
#!/usr/bin/env ruby | |
# | |
# queue_writer.rb | |
# | |
# $ ruby queue_writer.rb test_queue test_message | |
# puts 100 messages on the queue called test_queue | |
require 'rubygems' | |
require 'mq' | |
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
#!/usr/bin/env ruby | |
# | |
require 'rubygems' | |
require 'mq' | |
AMQP.start{ | |
i = 0 | |
10.times do | |
i += 1 |
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
#!/usr/bin/env ruby | |
github_dirs = [ | |
"/Users/cory/Library/Application Support/Cultured Code", | |
"/Users/cory/Downloads/moinmoin-wiki-db" | |
] | |
github_dirs.each do |dir| | |
puts "Syncing #{dir}" | |
Dir.chdir(dir) |
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
Deploying a Rails App with EC2 + S3 + Ubuntu | |
============================================ | |
Create EC2 Instance | |
------------------- | |
create new instance ami-bf5eb9d6 [http://alestic.com/](http://alestic.com/) | |
create new elastic ip | |
attach elastic ip to instance | |
point dns to elastic ip |
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
cfour-2:~ cory$ scala Royalty | |
----------------------------------------- | |
| X | | | | | | | | | | | |
----------------------------------------- | |
| | | X | | | | | | | | | |
----------------------------------------- | |
| | | | | | X | | | | | | |
----------------------------------------- | |
| | | | | | | | X | | | | |
----------------------------------------- |
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 'rubygems' | |
require 'twitter' | |
require 'sequel' | |
DB = Sequel.connect("sqlite://twits.db") | |
TWITTER = Twitter::Client.new | |
if !DB.tables.include?(:twits) | |
puts "Creating db table :twits" | |
DB.create_table(:twits) do |
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 'rubygems' | |
require 'twitter' | |
require 'sequel' | |
DB = Sequel.connect("sqlite://twits.db") | |
TWITTER = Twitter::Client.new | |
if !DB.tables.include?(:twits) | |
puts "Creating db table :twits" | |
DB.create_table(:twits) do |
OlderNewer