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
Gemfile.lock | |
.DS_Store | |
.rvmrc | |
.yardoc/ | |
doc/ | |
*.gem |
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
On Thu, Mar 1, 2012, at 02:49 PM, Balazs Kutil wrote: | |
>I'd have one question though. Is there some specific reason behind not using | |
> $ Digest::SHA256.file("big.file").hexdigest | |
>in the SHA example in readme / in the code? It seems to do exactly the same as the second code snippet, while keeping the memory footprint low... | |
hi Balazs, |
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 'fuzzy_inference_machine' | |
class CBECS < ActiveRecord::Base | |
fuzzy_inference_machine :infers => [:electricity_per_room_night, :fossil_fuels_per_room_night], # list of columns that this model is designed to infer | |
:basis => [:rooms, :year, :hdd, :cdd, :floors, :ac], # list of columns that are believed to affect energy use (aka MU) | |
:sigma => "(STDDEV(:column)/5)+(ABS(AVERAGE(:column)-:value)/3)", # empirically determined formula (SQL!) that captures the desired sample size once all the weights are compiled, across the full range of possible mu values | |
:membership => :energy_use_membership, # name of instance method to be called on kernel | |
:weight => :cbecs_weighting # (optional) a pre-existing row weighting, if any, provided by the dataset authors | |
# empirically determined formul |
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
Process: ruby [5706] | |
Path: /Users/seamusabshere/.rvm/rubies/ruby-1.9.3-p0/bin/ruby | |
Identifier: ruby | |
Version: ??? (???) | |
Code Type: X86-64 (Native) | |
Parent Process: bash [2964] | |
Date/Time: 2012-02-08 13:08:47.373 -0600 | |
OS Version: Mac OS X 10.6.8 (10K549) | |
Report Version: 6 |
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
# parallel 2 | |
## plain | |
gargantuan1:~ $ http_load -parallel 2 -fetches 3000 urls.txt | |
3000 fetches, 2 max parallel, 54000 bytes, in 28.6926 seconds | |
18 mean bytes/connection | |
104.557 fetches/sec, 1882.02 bytes/sec | |
msecs/connect: 0.296469 mean, 9.802 max, 0.04 min | |
msecs/first-response: 18.8286 mean, 27.964 max, 9.277 min |
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
# | |
# DEPRECATED - and probably broken | |
# use to_regexp gem instead | |
# https://github.com/seamusabshere/to_regexp | |
# https://rubygems.org/gems/to_regexp | |
# | |
class String | |
REGEXP_DELIMITERS = { | |
'%r{' => '}', |
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/bin/env ruby | |
require 'rubygems' | |
require 'remote_table' | |
# include to_regexp stuff from https://gist.github.com/926425 | |
def manufacturer_whitelist?(candidate) | |
@manufacturer_whitelist ||= RemoteTable.new(:url => AAAAAAA) | |
@manufacturer_whitelist.any? { |record| record['Manufacturer'].to_regexp.match(candidate) } |
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
vidalia:~/cm1 (statistics) $ rails console | |
Loading development environment (Rails 3.0.6) | |
ruby-1.9.2-p180 :001 > m = AutomobileTrip.method(:run_data_miner_on_belongs_to_associations) | |
=> #<Method: AutomobileTrip([...])(ActiveRecord::Base).run_data_miner_on_belongs_to_associations> | |
ruby-1.9.2-p180 :002 > m.source_location | |
=> ["/Users/seamus/.rvm/gems/ruby-1.9.2-p180/bundler/gems/earth-3b880b7687ac/lib/earth/active_record_ext.rb", 3] |
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/bin/env ruby | |
PRESUMPTIVE_RAILS_ROOT = "/data/[APP_NAME]/current" | |
LOG_PATH = "/data/[APP_NAME]/shared/log/delayed_job_singleton.log" | |
Dir.chdir PRESUMPTIVE_RAILS_ROOT | |
require 'home_run' | |
require "rubygems" | |
require "bundler/setup" |
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
diff --git a/data_miner_test.rb b/data_miner_test.rb | |
index 69c9cd5..fca902c 100644 | |
--- a/data_miner_test.rb | |
+++ b/data_miner_test.rb | |
@@ -4,12 +4,12 @@ class Shop < ActiveRecord::Base | |
end | |
class ItemDetail < ActiveRecord::Base | |
- set_primary_key :id | |
+ set_primary_key :row_hash |