Created
January 12, 2012 05:24
-
-
Save sczizzo/1598932 to your computer and use it in GitHub Desktop.
Experiment for ARTV150: Obfuscation
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 -w | |
# Sean Clemmer Why the QR code? | |
# Basically cause I don't like it. It's a token, like all physical art in a way | |
# It's obscure and immutable and insensitive and secretive. It's the leftovers you ant | |
# But also well-formed and regular and geeky. Cause the "real thing" is gone. | |
# A QR code is just a two-dimensional bar code But it's a token that explicitly | |
# it has some neat stuff like error detection and speed directs its viewers, and that's a powerful tool | |
# it doesn't store all that much data--mostly we encounter links Because I'm nosy and human | |
# URLs, pointers, addresses, identifiers and yeah I wanna see what people do | |
# {PRAGMA INSERT QUOTE and yeah also change them | |
# a link I can hide my eyes behind the QR code | |
# is a pointer and exist somewhere between | |
# essentially weightless} good behavior and bad | |
# The weightlessness is nice Because that's where it's at. | |
# Easy to carry. ### | |
f = File.read __FILE__ # Let's reflect on this | |
# And ignore the things we don't have time for | |
# (Like reading the manual who does that?) | |
f.gsub!(/'|"/, '') ; f.gsub!(/[^a-zA-Z ]/, ' ') ; f.gsub!(/ +/, ' ') ; f.downcase! | |
cs = f.gsub(' ', '').chars.to_a ; ws = f.split(' ') | |
class Array # We have many thoughts | |
def y! &op ; r = [] # Let's consider them all in turn | |
self.uniq.each do |m| # First, identify | |
l_w_m = length ; self.delete m ; l_wo_m = length # What would the world be without? | |
r << [ m, l_w_m - l_wo_m ] # Second, record | |
end ; op.call r ; end # Third, release | |
# Now this next trick is really more about convenience | |
# Or obfuscation, whichever way you think about it | |
def z! &op ; self.y! { |p| p.sort_by! { |m| m.first }.map &op } ; end ; end | |
ws.z! { |w, n| puts "%-20s %d" % [ w, n ] } ; cs.z! { |c, n| n.times { print c } ; puts } | |
### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment