Skip to content

Instantly share code, notes, and snippets.

@FiXato
Created April 14, 2012 21:45
Show Gist options
  • Save FiXato/2388021 to your computer and use it in GitHub Desktop.
Save FiXato/2388021 to your computer and use it in GitHub Desktop.
Returns a sorted list of the most triggered spamfilters based on UnrealIRCd's spamfilter.log
#!/usr/bin/env ruby
require 'yaml'
UNREAL_PATH = "~/UnrealIRCd/logs/spamfilter.log"
matches = Hash.new{|hash,key| hash[key] = 0}
`grep -o \\\'.\\\\+\\\': #{UNREAL_PATH} |sort`.split("\n").each do |match|
matches[match] += 1
end
puts matches.sort_by{|k,v|v}.map{|k,v|'%s hits: %s' % [v,k[1..-3]]}.reverse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment