Last active
August 16, 2016 01:47
-
-
Save JoshCheek/b543a35c09767c14eb6abc7f49db8864 to your computer and use it in GitHub Desktop.
Obfuscated printing of "wat"
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
# ruby -e '$.-=~$.;$_=-~$.<<-~-~-~$.;$:<<$_|=$_<<$.;$_|=$_>>$.;$:.<<(-~$.<<$.);$>.<<$/[$....$.]<<$_+$:[-$.]+-~$.+$.<<$:[~$.]+$.<<$_+$:[-$.]<<$/' | |
# ruby -e '$.-=~$.;$_=-~$.<<-~-~-~$.;$:<<$_|=$_<<$.;$_|=$_>>$.;$:<<(-~$.<<$.);$>.<<$/[$....$.]<<$_+$:[-$.]+-~$.+$.<<$:[~$.]+$.<<$_+$:[-$.]<<$/' | |
# ruby -e '$.-=~$.;$_=-~$.<<-~-~-~$.;$:<<$_|=$_<<$.;$_|=$_>>$.;$:<<-~$.*-~$.;$>.<<$/[$....$.]<<$_+$:[-$.]+-~$.+$.<<$:[~$.]+$.<<$_+$:[-$.]<<$/' | |
# ruby -e '$.-=~$.;$;=-~$.<<-~-~$.;$;|=$;<<$.;$:<<$;--$;;$;|=$;--$;;$:<<-~$.-~$.;$>.<<$/[$....$.]<<-~$;--$:[-$.]-~$.<<-~$:[~$.]<<-~$;-~-~$.<<$/' | |
# ruby -e '$.-=~$.;$;=-~$.<<-~-~$.;$;|=$;<<$.;$>.<<$/[$....$.]<<-~[$;|$;--$;][~-$.]-~$.-~$.-~$.<<-~$;--$;<<-~[$;|$;--$;][~-$.]-~-~$.<<$/' | |
# ruby -e '$;=$.-=~-~$.;$.<<=$.;$;=--~-$.<<-~-~$;;$>.<<$/[$.-$....$.-$.]<<$;--~-$.<<-~$;-$.-$.<<-~-~-~-~$;<<$/' | |
require 'stringio' | |
$stdout = StringIO.new | |
eval(code=DATA.read.strip) | |
$stdout.string # => "wat\n" | |
code.chars.length + "ruby -e''".length # => 108 | |
code.chars.uniq # => ["$", ";", "=", ".", "-", "~", "<", ">", "/", "[", "]"] | |
.length # => 11 | |
__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
# Tweeted as https://twitter.com/josh_cheek/status/765261304231628800 | |
ruby -e '$.-=~$.;$_=-~$.<<-~-~-~$.;$:<<$_|=$_<<$.;$_|=$_>>$.;$:<<(-~$.<<$.);$><<(""<<$_+$:[-$.]+-~$.+$.<<$:[~$.]+$.<<$_+$:[-$.]<<$/)' | |
# Since improved to this | |
# * removed these chars: |_():+" | |
# * added 4 periods in a row | |
# * confusing semicolons | |
# * If there was a way to get an empty string, I could also get rid of the brackets | |
ruby -e '$;=$.-=~-~$.;$.<<=$.;$;=--~-$.<<-~-~$;;$>.<<$/[$.-$....$.-$.]<<$;--~-$.<<-~$;-$.-$.<<-~-~-~-~$;<<$/' |
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
$\=$/[$....$.] | |
$.-=~$. | |
$_=-~$.<<-~-~-~$. | |
$:<<$_|=$_<<$. | |
$_|=$_>>$. | |
$:<<-~$.*-~$. | |
$>.<<$\<<$_+$:[-$.]-~$.+$.<<$:[~$.]+$.<<$_+$:[-$.]<<$/ | |
# >> wat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment