magic.jar

magic.jar is the runtime component of the TinyBrain.de Lua system. It allows you to run sandboxed scripts. Also, to up- and download them.

Author contact: stefan.reich.maker.of.eye@gmail.com

Download

Ready to use binary: magic.jar!   (Current version: R15. Sources on request.)

Requirements

magic.jar works on all operating systems that support Java. (The Lua runtime is contained in magic.jar, so no Lua interpreter is needed.)

All you need is a Java SDK or JRE in your path.

News

R7 can search for snippets ("search") and show GUIs ("gui").

R8 adds the "jpeg" command.

R9 can transparently compile GUIs to Java ("fastgui").

R10 allows control over BASH with "-power" (for "run" and "gui").

R11 allows direct embedding of Java (directJava function) in -power mode. Example: #219

R15 runs add the EXTREMELY powerful "beanshell" command. :)

Usage

java -cp magic.jar [command]

Shortcut usage on Unix systems

If you download these files and put them in a directory that's in your path (and with magic.jar in the same directory), you only need to type the commands themselves, like this: run 86|apply 42

Commands

get 47 Download snippet 47. Prints snippet contents to console. For saving, pipe into a file.
run 86 Run snippet 86 and print result to console. (Both "print" and "return" can be used in the script to generate output.)
apply 42 Run snippet 42 with input from STDIN. Print results to console.
upload [user] Upload snippet as user [user]. Contents is taken from stdin, so pipe something in!
upload [user] 123 Update existing snippet 123 created by user [user]. New snippet contents is taken from stdin.
search [keyword] Search for a snippet (quick search - does not search snippet contents).
gui 105 Show GUI for snippet 105.
fastgui 185 (Unix wrappers only) Show GUI for snippet 185 with maximum optimization (compilation to Java and highest-optimizing Java VM).
jpeg [-o <outputfile>] (<snippet id>|<lua file>|<lua code>) Make a .jpeg image from Lua file, code or snippet. Default output file name: TinyBrain.jpeg
beanshell "<Java code>" Runs the supplied code which is, exactly speaking, in BeanShell, which is similar to Java. Quotes are for putting the Unix shell to sleep (it reacts to too many "special" characters).

Examples

Pitch

Any text generation or transformation can be expressed in TinyBrain!

So why not make your own examples of useful things? Anything can be done anywhere with TinyBrain. Replace the most complex computation with a single number!

See the possibilities!!!!!! :)))