Last active
December 20, 2015 03:09
-
-
Save whitequark/59ae9ed4593726df5fcb to your computer and use it in GitHub Desktop.
emacs compatible unicode (c) erikh
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 x.rb <<<"проверка" | |
"\M-P\M-?\M-Q\M-\C-@\M-P\M->\M-P\M-2\M-P\M-5\M-Q\M-\C-@\M-P\M-:\M-P\M-0" | |
$ ruby -e 'puts "\M-P\M-?\M-Q\M-\C-@\M-P\M->\M-P\M-2\M-P\M-5\M-Q\M-\C-@\M-P\M-:\M-P\M-0"' | |
проверка |
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
Hash.new{|_,v|v.chr}.tap{|m|m[34]='\"';m[92]='\\\\';m[127]='\C-?'; | |
puts '"'+ARGF.read.strip.each_byte.map{|b|b&128==0?m[b]:('\M-'+( | |
b&96==0?'\C-'+m[b&-129|64]:m[b&-129]))}.join+'"'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment