Skip to content

Instantly share code, notes, and snippets.

@troter
Created March 9, 2011 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save troter/862163 to your computer and use it in GitHub Desktop.
Save troter/862163 to your computer and use it in GitHub Desktop.
pickup hexspeak.
# -*- coding: utf-8; mode: ruby -*-
#
# usage:
# hg log --template "{node} {author} {desc|firstline}\n" | ruby pickuphexspeak.rb
first_class = %w[
abadbabe baadf00d baddcafe cafebabe deadbeef defec8ed
facefeed fee1dead badcab1e feedface deaddead beadface
]
second_class = %w[
c0ed f00d cafe beef dead face feed fee1
]
first_class_commit = []
second_class_commit = []
def included_speak(hex, speaks)
speaks.select {|speak| hex.include? speak }
end
STDIN.each do |l|
hex = l.split(" ")[0]
included = included_speak(hex, first_class)
unless included.empty?
first_class_commit << [included, l]
next
end
included = included_speak(hex, second_class)
unless included.empty?
second_class_commit << [included, l]
next
end
end
first_class_commit.each do |d|
puts "#{d[0].join(',')} #{d[1]}"
end
second_class_commit.each do |d|
puts "#{d[0].join(',')} #{d[1]}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment