Jump to content


greygraphics's Content

There have been 16 items by greygraphics (Search limited from 30-March 23)


By content type

See this member's

Sort by                Order  

#262541 Titlebar for Computers

Posted by greygraphics on 08 December 2016 - 08:59 AM in Suggestions

Hi everybody,

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
Attached Image: big4.png

This would make full-screen troubleshooting so much easier :)

Attached Thumbnails

  • Attached Image: big3.png



#262523 Brainfuck Interpreter

Posted by greygraphics on 07 December 2016 - 01:16 PM in APIs and Utilities

Hello again,

I am back with a new program: An interpreter for the language Brainfuck.

What is Brainfuck?

Quote

Brainfuck is an esoteric programming language created in 1993 by Urban Müller, and notable for its extreme minimalism.
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
You have an array of (in this case) 1024 bytes. The pointer and each byte is initialized to 1 (we use lua, not C) and 0.
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 bfq
to 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 :test
You 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. :)

Attached Thumbnails

  • Attached Image: 2016-12-08_02.03.03.png



#254424 Better os.run()

Posted by greygraphics on 21 June 2016 - 07:03 PM in Ask a Pro

View Postapemanzilla, on 21 June 2016 - 02:44 PM, said:

View Postgreygraphics, on 21 June 2016 - 02:43 PM, said:

View Postapemanzilla, on 20 June 2016 - 05:13 PM, said:

View Postgreygraphics, on 20 June 2016 - 04:59 PM, said:

Hey,
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?
You can do something like this:
os.run({ api={} }, "program")

Thank you for your answer, I will try this as soon as possible. I found a different solution though:
local env = {['os']=new api}
os.run (env,program)

That's exactly the same thing though...

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

View Postapemanzilla, on 20 June 2016 - 05:13 PM, said:

View Postgreygraphics, on 20 June 2016 - 04:59 PM, said:

Hey,
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?
You can do something like this:
os.run({ api={} }, "program")

Thank you for your answer, I will try this as soon as possible. I found a different solution though:
local env = {['os']=new api}
os.run (env,program)



#254328 Better os.run()

Posted by greygraphics on 20 June 2016 - 04:59 PM in Ask a Pro

Hey,

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

View PostAnavrins, on 16 June 2016 - 10:25 PM, said:

The current hash algorithm is not safe at all anyway.
Spoiler
All character is encoded individually, by multiplying with some value, and that value can of course be retrieved by calculating the greatest common divisor of all the numbers.
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

View PostMikk809h, on 16 June 2016 - 07:14 PM, said:

View Postgreygraphics, on 16 June 2016 - 07:11 PM, said:

View PostSGunner2014, on 16 June 2016 - 03:20 PM, said:

Why are the passwords encrypted? Have you thought of hashing them instead?
Yes I did, but hashed codes can be found in pre-made tables. I think this way it is more secure...
Use a salt with the password. That'd prevent lookup-tables from working properly, without also getting the salt.

Ok, I will look into that, although I don't have much experience with encrypting text. :)



#253937 Password protected OS

Posted by greygraphics on 16 June 2016 - 07:11 PM in Operating Systems

View PostSGunner2014, on 16 June 2016 - 03:20 PM, said:

Why are the passwords encrypted? Have you thought of hashing them instead?
Yes I did, but hashed codes can be found in pre-made tables. I think this way it is more secure...



#253769 Password protected OS

Posted by greygraphics on 14 June 2016 - 04:48 PM in Operating Systems

Hey,

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)
Added APIs:
  • secure (A small API which allows for fast password encryption and check)
Added directories:
  • /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

Hey, thanks for all your answers, the redstone was just a small example, but I think I got the read function kind of figured out now.



#251353 [MC 1.7.10 | CC 1.65] OpenCCSensors

Posted by greygraphics on 16 May 2016 - 11:45 AM in Peripherals and Turtle Upgrades

Um, the API is not working.
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

So, when I want to let's say make a redstone switch with on/off commands, I would have to
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

You could also use
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

Hey,

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

Hey, I am back!

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:
Spoiler



#251289 Self-Contained Package Generator

Posted by greygraphics on 15 May 2016 - 01:55 PM in APIs and Utilities

Hey, nice work! I did something similar a few days ago. Maybe you want to check it out?