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
# in terminal | |
In this lesson, we will have a look at two more activerecord | |
relationships: has and belongs to many and has many through. Both of | |
these relationships use a join table, and can be quite tricky to | |
implement at first. We'll start with has and belongs to many and then | |
cover has many through. | |
In our journal we want to be able to classify our entries by how we | |
felt when we wrote them. Maybe we were feeling happy when we wrote |
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
(add-to-list 'load-path | |
"~/.emacs.d/plugins") | |
(setq mac-command-key-is-meta t) | |
(setq default-tab-width 2) | |
(server-start) | |
(require 'pair-mode) | |
;;;; editor | |
;; font |
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
Oinkmaster downloads one or more rule packs. | |
Oinkmaster downloads rule packs over http. | |
Oinkmaster downloads rule packs over ftp. | |
Oinkmaster downloads rule packs over scp. | |
Oinkmaster can disable rules in a downloaded rule pack. | |
Oinkmaster can modify rules in a downloaded rule pack. | |
Oinkmaster compares the rules in a downloaded pack to the rules already installed. | |
Oinkmaster can ignore files in a downloaded rule pack. | |
Oinkmaster can enable rules disabled in a downloaded rule pack. | |
Oinkmaster copies new rules to the Snort installation. |
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
A User through Oinkmaster's config disables rules in a downloaded rule pack to remove unwanted rules. | |
A User through Oinkmaster's config modifies rules in a downloaded rule pack to customize rules for his environment. | |
A User through Oinkmaster's config ignores files in a downloaded rule pack to remove unwanted rule categories. | |
A User through Oinkmaster's config enables rules disabled in a downloaded rule pack to include deprecated rules he wants to run. | |
A User through Oinkmaster's config prevents updated rules from being copied to the Snort installation so it will not override an older version of the rule he wants to run. | |
A User running Oinkmaster compares the rules in a downloaded pack to the rules already installed to determine which rules downloaded are to be copied over. | |
A User running Oinkmaster downloads one or more rule packs to update their Snort installation so his server will have current rules. | |
A User running Oinkmaster downloads rule packs over http to get rules from Snort.org or BleedingSn |
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 'nokogiri' | |
class MyDoc < Nokogiri::XML::SAX::Document | |
def start_element(name, attrs) | |
@count ||= 0 | |
@count +=1 if name == "item" |
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 'nokogiri' | |
class MyDoc < Nokogiri::XML::SAX::Document | |
def start_element(name, attrs) | |
@count ||= 0 | |
@count +=1 if name == "item" |
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 'couchrest' | |
CouchRest::Model.default_database = CouchRest.database!('snort-playground') | |
class Rule < CouchRest::Model | |
end |
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
not all expectations were satisfied | |
unsatisfied expectations: | |
- expected exactly once, not yet invoked: #<CouchRest::Database:0x227fd74>.view('snort/signature-revision') | |
satisfied expectations: | |
- allowed any number of times, already invoked once: #<CouchRest::Database:0x227fd74>.view(any_parameters) |
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
>> CouchRest.get("http://localhost:5984/snort-playground/_design/snort") | |
=> {"language"=>"javascript", "_rev"=>"137402253", "_id"=>"_design/snort", "views"=>{"signature_revision"=>{"map"=>"function(doc) {\n if (doc['couchrest-type'] == 'Rule') {\n emit(doc._id, [doc.signature, doc.revision, doc.category, doc._id, doc._rev])\n\n }\n }\n"}}} | |
>> db.info | |
=> {"purge_seq"=>0, "doc_count"=>13841, "instance_start_time"=>"1232500553332698", "update_seq"=>16560, "disk_size"=>23829352, "compact_running"=>false, "db_name"=>"snort-playground", "doc_del_count"=>1356} | |
>> db.get("_design/snort") | |
URI::InvalidURIError: path conflicts with opaque | |
from /opt/local/lib/ruby/1.8/uri/generic.rb:469:in `check_path' | |
from /opt/local/lib/ruby/1.8/uri/generic.rb:495:in `path=' | |
from /Users/bryan/Development/sourcefire/rulesapi/vendor/gems/rest-client-0.8/lib/rest_client.rb:197:in `process_result' | |
from /Users/bryan/Development/sourcefire/rulesapi/vendor/gems/rest-client-0.8/lib/rest_client.rb:177:in `transmit' |
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
>> str = "Z" | |
=> "Z" | |
>> str[0] | |
=> 90 |