Giter VIP home page Giter VIP logo

tide's Introduction

#Tide Tide is a ligthweight, online Lua REPL for LuaJIT with Torch support. REPL routines are based on Trepl and Luaish. Frontend was modified from Repl.it.

Features

  • Small footprint http server civetweb with SSL support.
  • A naive login (optional)
  • Code editor for editing scripts.
  • REPL functions for loading and saving scripts into code editor.
  • Features from Luaish and Trepl:
    • Shell command execution, feedback results to a global Lua function
    • Tab-completion
    • History
    • Pretty print (table introspection and coloring, optional)
    • Each command is profiled, timing is reported (optional)
    • Print all user globals with who()
    • Import a package's symbols globally with import(package)
    • Optional strict global namespace monitoring
    • Shortcuts can be specified in configuration file
  • Torch support (can be disabled from configuration file)
  • Image display (Torch tensors) in fancy JsPanels
  • WebSocket based communication

Requirements (Server-side)

  • Linux (tested in Ubuntu 14.04)
  • LuaJIT
  • Civetweb: Embedded C/C++ web server
  • Torch-7: A scientific computing framework for LuaJIT (optional)
  • jsmn: A minimalistic library for JSON parsing
  • lpath : Path manipulation module for Lua
  • lua-cjson: A fast JSON encoding/parsing module for Lua
  • lua-MessagePack: Pure Lua implementation for msgpack (spec v5)
  • image: An Image toolbox for Torch
  • OpenSSL

Client-side Libraries

Installing

LuaJIT, Torch-7 (optional), lpath, lua-cjson, lua-MessagePack, image(optional) and OpenSSL should be installed before tide installation.

To install tide:

git clone https://github.com/bitradio/tide.git
cd tide
make

Modify and copy configuration file .luarc.lua to your home directory

cp .luarc.lua ~/  

##Running In tide directory

./server

The executable forks a child process. The main process listens on the control_port (default 8080) and redirects requests to the repl_port (default 8081) where the child process listens to. After serving static files, with a GET request for http(s)://localhost:8081/wsserver.lua, child process creates a lua state, establishes websocket connection and initializes REPL.

After executing server, in a browser, tide can be opened at http(s)://localhost:8080 (port numbers and SSL support can be specified in .luarc.lua configuration file).

##Configuration Configuration options can be specified as a Lua table in .luarc.lua file (this file should be copied to the user's home directory).

{
  control_port = 8080,
  repl_port = 8081,
  ssl = false,
  ssl_dir = "./ssl/server.pem",
  login = {user = "foo", password="bar"},
  torch = true,
  trepl = {glo,bals=false, color=true, timer=false},
  images = false,
  keeplines = 500,
  shortcuts = {io="io.write"}
}

control_port: used to start/kill REPL process and to terminate tide server. repl_port: used for REPL's websocket connection ssl: if true https protocol will be used ssl_dir: directory for certification files login: username and password will be asked when client connects. torch: torch package will be loaded. trepl: if defined, Trepl package will be loaded

globals: displays a warning message when a global Lua variable defined color: color printing timer: display the time spent for execution of a script

images: image (Torch tensors) display function will be loaded keeplines: number of lines to save for history shortcuts: list of shortcutted commands

To disable "login", "trepl" and "shortcuts" options, just comment out the lines. If "torch" option is false then "images" will be ignored.

##Usage Any line begining with [.] is assumed to be a shell command:

th> .ls
luaish.lua  lua.lua  readme.md

for details please refer to Luaish.

For loading/saving scprits/texts files into/from code editor use:

th> .load filename
th> .save filename

(Code editor can be cleared by Ctrl+A:select all and then delete)

To display a Torch tensor as an image:

th> display(image.lena(), {id='img4', zoom=0.6, legend="test"})

For pretty printing tables use:

th> cprint({str="12345", num=10, bool=true})
{
  bool : true
  num : 10
  str : "12345"
}

To terminate tide web server :

th> .exit

License and Disclaimer

Tide is MIT licensed.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

tide's People

Contributors

alisabri avatar rmozel avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.