Skip to content

Instantly share code, notes, and snippets.

@kaineer
Created September 16, 2010 07:12
Show Gist options
  • Save kaineer/582087 to your computer and use it in GitHub Desktop.
Save kaineer/582087 to your computer and use it in GitHub Desktop.
Транслитерация qwerty -> йцукенг
localhost@~:$ itsu "eue? z nfr b levfkf? xnj xnj-nj ghjgecnbkb"
угу, я так и думала, что что-то пропустили
#!/usr/bin/env ruby
str = ARGV[ 0 ]
qwe = "qwertyuiop[]asdfghjkl;'zxcvbnm,.?".unpack( "U*" )
its = "йцукенгшщзхъфывапролджэячсмитьбю,".unpack( "U*" )
puts str.unpack( "U*" ).map {|i|
idx = qwe.index( i )
idx ? its[ idx ] : i
}.pack( "U*" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment