Skip to content

Instantly share code, notes, and snippets.

@scmx
Created October 2, 2023 11:53
Show Gist options
  • Save scmx/f209886afe30c280736da099c58b94c6 to your computer and use it in GitHub Desktop.
Save scmx/f209886afe30c280736da099c58b94c6 to your computer and use it in GitHub Desktop.
Obfuscate sentence by scrambling letters except first and last #ruby #shell

Obfuscate sentence by scrambling letters except first and last

#ruby #shell

obfuscate-sentence

#!/usr/bin/env ruby

ARGF.read.split("\n").each do |line|
  puts line
    .split(' ')
    .map { |s| s[0] + s[1..-2].split('').shuffle.join('') + s[-1] }
    .join(' ')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment