- ComputerCraft | Programmable Computers for Minecraft
- → greygraphics's Content
greygraphics's Content
There have been 16 items by greygraphics (Search limited from 30-March 23)
#262541 Titlebar for Computers
Posted by greygraphics on 08 December 2016 - 08:59 AM in Suggestions
When I exprimented with "full-screen" programs and had to troubleshoot some bugs that did not appear on one computer but did on the other one, I was looking for a way of letting me know the computer label (because it is convenient) and display messages about the current program status without obstucting the screen I was using for the program.
Of course there are easy ways of avoiding that problem, but still, this got me thinking:
a title bar would be really useful right now!
My suggestion:
Add a dedicated titlebar to the normal and advanced computers. A second screen that is controlled just like the main screen is, but with another API.
How would you use this?
You would control the screen just like the main screen, but not with the term API. That way the main screen could receive updates like term.clear, term.setBackgroundColour, etc. without affecting the title bar and make it easy for a program to supply the user with information about the running program without taking up space on the main screen.
This is a concept of how it could look
This would make full-screen troubleshooting so much easier
#262523 Brainfuck Interpreter
Posted by greygraphics on 07 December 2016 - 01:16 PM in APIs and Utilities
I am back with a new program: An interpreter for the language Brainfuck.
What is Brainfuck?
Quote
The language consists of only eight simple commands and an instruction pointer. While it is fully Turing-complete, it is not intended for practical use, but to challenge and amuse programmers.
The language's name is a reference to the slang term brainfuck, which refers to things so complicated or unusual that they exceed the limits of one's understanding.
- https://en.wikipedia.../wiki/Brainfuck (8th of December 2016)
Brainfuck has only eight commands:
- < Decrease pointer value
- > Increase pointer value
- + Increase the value the pointer points at
- - Decrease the value the pointer points at
- [ Open a loop
- ] close a loop
- . Print out the ASCII character for the current cell
- , Write an ASCII value to the current cell
Both values over- and underflow if you modify them.
How do I use this program?
The program is available on pastebin, you can either copy the code and paste it into a file or type in
pastebin get 1QGq7FZr bfqto download it directly.
It comes with several commands:
Brainfuck - Help :usage - How to use this program :info - Information about Brainfuck :help - This message :test - Runs a small program :learn - Explains how to use Brainfuck
To run Brainfuck code you simply type
Brainfuck - Usage 'bfq <filename>' 'bfq :<usage|info|help|test|learn>'and the program opens and executes the file.
Included in the program is a small 'Hello, world!' code that is accessible via
bfq :testYou can see that code in action in the image attached.
Have fun with this program!
Please let me know if you find any bugs or have any complaints.
#254424 Better os.run()
Posted by greygraphics on 21 June 2016 - 07:03 PM in Ask a Pro
apemanzilla, on 21 June 2016 - 02:44 PM, said:
Is it? I am not that experienced with lua,
#254387 Better os.run()
Posted by greygraphics on 21 June 2016 - 02:43 PM in Ask a Pro
#254328 Better os.run()
Posted by greygraphics on 20 June 2016 - 04:59 PM in Ask a Pro
I recently discovered the os.run() command and I was wondering why there is only a way to add apis but not disable them. Maybe that would be cool?
#254003 Password protected OS
Posted by greygraphics on 17 June 2016 - 01:59 PM in Operating Systems
Anavrins, on 16 June 2016 - 10:25 PM, said:
There is some good hashing algorithms on my profile page that you can use to securely store password, mainly PBKDF2-SHA2.
The salt doesn't need to be secret, but don't simply concatenate it the password, use HMAC-SHA2 or PBKDF2-SHA2 instead.
Well, thanks. As I mentioned earlier, I do not know much about encoding text.
I will look into it.
Um, and may I ask for an advice? If I take the algorith and make it multiply the numbers like this:
function encode(sInput) local encoded = "" local value = 0 for i=1,string.len(sInput),1 do value = value+string.byte(string.sub(sInput,i,i)) end for i=1,string.len(sInput),1 do encoded = encoded..tostring(string.byte(string.sub(sInput,i,i))*value^i*value) --Actually I don't know how to do this X^n thing correctly end return encoded end
Would it be more secure?
#253943 Password protected OS
Posted by greygraphics on 16 June 2016 - 07:21 PM in Operating Systems
#253937 Password protected OS
Posted by greygraphics on 16 June 2016 - 07:11 PM in Operating Systems
#253769 Password protected OS
Posted by greygraphics on 14 June 2016 - 04:48 PM in Operating Systems
I created this small, password protected OS. It is called SecOS and cannot be terminated. Also, the password of the users are encrypted so that you cannot read them directly. However, you can edit them. They are (as far as I know) only decryptable with themselves as password.
Added commands:
- mkusr (Create a new user in the /users directory)
- passwd (Change the password of the user you log in)
- secure (A small API which allows for fast password encryption and check)
- /users (The directory every user and password is stored)
Link: SaRwxwcn
Note: This file can unpack itself, simply type in "<Filename> <Filename>"
I hope you have fun with this.
#251459 How do I read an input while it is being read?
Posted by greygraphics on 17 May 2016 - 07:28 PM in Ask a Pro
#251353 [MC 1.7.10 | CC 1.65] OpenCCSensors
Posted by greygraphics on 16 May 2016 - 11:45 AM in Peripherals and Turtle Upgrades
After the first time accessing it on an advanced computer the whole folder is gone.
#251352 How do I read an input while it is being read?
Posted by greygraphics on 16 May 2016 - 11:25 AM in Ask a Pro
local input = read("",{},{"on","off"})?
#251299 Can you pass boolean values as command line arguments?
Posted by greygraphics on 15 May 2016 - 04:37 PM in Ask a Pro
local direction = (args[2] == "true" and true) or (false)
#251296 How do I read an input while it is being read?
Posted by greygraphics on 15 May 2016 - 03:21 PM in Ask a Pro
you know how the shell in CC automatically suggests the file endings when typing the first letter?
I am curious how this is done. Is it via os.pullEvent("key") or via io.read()? And how do you read the io.read() value while it is being typed?
I already had a look at the code for the shell, but I could not figure out how they do this.
So, how is this magic performed?
#251295 File packer and unpacker
Posted by greygraphics on 15 May 2016 - 03:06 PM in APIs and Utilities
Due to mysterious reasons my account was deleted, so I'll just post this again.
I made a program that can pack multiple files into one and another program to unpack those files. This allows for self-extracting programs and utilities, it even can unpack itself!
File packer: AnN7sQNg
File unpacker: 1b2u56ms
My pastebin: Greygraphics
How it works:
Packing the files:
- Open target file
- Read files to pack into an array and add "NEWFILE" and "EOF" as headers
- Pack everything into "--[[" and "--]]"
- Write the array to the target file, write or append mode
- Cleanup
- Read the whole file into an array
- Scan this array for any headers ("NEWFILE")
- 1. Go to next header 2. Read name below 3. Read contents below 4. Write all the contents into file 5. Repeat
- Cleanup
#251289 Self-Contained Package Generator
Posted by greygraphics on 15 May 2016 - 01:55 PM in APIs and Utilities
- ComputerCraft | Programmable Computers for Minecraft
- → greygraphics's Content