This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Geforce Fan's profile picture

April fools - Scramble someone's aliases!

Started by Geforce Fan, 01 April 2015 - 07:55 PM
Geforce Fan #1
Posted 01 April 2015 - 09:55 PM
I made a small, neat little program that will scramble someone's shell aliases. So "edit" might actually be clear, clear might be programs, or bg might be fg! It's a harmless prank, and does NOT brick their computer! Once they realize what's going on, they can use /rom/programs/edit, for example, to fix it.
Prank your friends!
It works by creating a new directory, going into that directory, then checking for programs. Then, it shell.resolveProgram 's the aliases, to get a list of what programs they are (for example: cd would be "/rom/programs/cd"). Then, it goes through the list of aliases and puts a random path for it. So, cd might be "/rom/programs/list" now.
To get it:
pastebin get 248wWNJr startup

This doesn't count as malicious, right? Like I said, they can just call the programs from ROM.
Edited on 01 April 2015 - 07:57 PM
Lupus590 #2
Posted 01 April 2015 - 10:27 PM
I would agree this is a prank program,which sit on the fence of malicious.
TheOddByte #3
Posted 01 April 2015 - 11:22 PM
Where are your parantheses? I hate to see someone not using them! :P/>
LDDestroier #4
Posted 02 April 2015 - 12:01 AM
You make m-
Goodbye

…damn I shutdown
Geforce Fan #5
Posted 02 April 2015 - 12:02 AM
Where are your parantheses? I hate to see someone not using them! :P/>
Why?
print""
is shorter than
print("")
apemanzilla #6
Posted 02 April 2015 - 04:26 AM
Where are your parantheses? I hate to see someone not using them! :P/>/>
Why?
print""
is shorter than
print("")
It's a convention. No real difference, but I still prefer them anyways as well. It makes the code more uniform.
TheOddByte #7
Posted 06 April 2015 - 01:40 PM
It's a convention. No real difference, but I still prefer them anyways as well. It makes the code more uniform.
If I remember correctly, concatenation doesn't work without parantheses

--# This would throw an error, unexpected symbol or something
local str = " World!"
print"Hello" .. str
apemanzilla #8
Posted 06 April 2015 - 01:58 PM
It's a convention. No real difference, but I still prefer them anyways as well. It makes the code more uniform.
If I remember correctly, concatenation doesn't work without parantheses

--# This would throw an error, unexpected symbol or something
local str = " World!"
print"Hello" .. str

Yes, because it is executing the "print'hello'" bit and then reaching the concatenation. Lua has order of operations just like math - so this could be compared to the difference between 2 * 3 + 1 and 2 * (3 + 1)
TheOddByte #9
Posted 06 April 2015 - 02:14 PM
Well anyway, thanks, my point has been made why it's better to use parantheses :P/>
Geforce Fan #10
Posted 08 April 2015 - 11:13 PM
Where are your parantheses? I hate to see someone not using them! :P/>/>
Why?
print""
is shorter than
print("")
It's a convention. No real difference, but I still prefer them anyways as well. It makes the code more uniform.
My philosophy for code is that if there's an easier, shorter way to do it that doesn't sacrifice readability, do it.
print"string" doesn't sacrifice readability to me.