Skip to content

Instantly share code, notes, and snippets.

View adiprnm's full-sized avatar

Adi Purnama adiprnm

View GitHub Profile
@adiprnm
adiprnm / obfuscate.rb
Last active July 27, 2025 13:59
Obfuscate the text within a file
# Usage: ruby obfuscate.rb /path/to/file line-offset
# Example: ruby obfuscate.rb ./test.md 3
# The command above will obfuscate the text in the given file path from line 4 onwards. The obfuscated result will be stored in ./test-obfuscated.md
def obfuscate(text)
return text if text == ''
text.split(' ').map do |token|
token.chars.map do |char|
if char.ord.between?(65, 90)