def downloadScript [] { rm -f bundle.js print $"(ansi yellow)Downloading the script.." wget -q https://pianoverse.net/bundle.js } def applyPatches [] { print $"(ansi yellow)Applying patches!.." let patches = (ls build | find .patch | each { |i| $i.name }) $patches | each {|i| let splitted = open $i | split row -r '\n'; let needle = $splitted | get 0; let haystack = $splitted | skip 1 | str join ""; open bundle.js | str replace $needle $haystack| save -f bundle.js print $"(ansi green)Applied patch ($i)!" } } downloadScript applyPatches print $"(ansi green)Happy hacking!"