http request examples for luasocket

I was looking for http library in lua and landed in luasocket.http page. It isn’t well documented, sent few GET, POST, PUT requests and figured few bits. This blog post aims in bridging the gap(code examples). In this example, I will use httpbin as target site. The complete code is available as gist. The following code should be executed like a standalone lua file(lua lua_httpbin.lua) and while executing the code in interpreter please make local variables http, ltn12, base_url as global variables. [Read More]

cp command implementation and benchmark in python, go, lua

I was wondering how much will be the speed difference between cp command, rsync and implementation in python, go, lua and so wrote this code. Background python has two versions one with gevent and without gevent. Both the version uses shutil for copying files and directory tree. go uses https://github.com/opesun/copyrecur for copying recursively. lua uses lfs - LuaFileSystem module. lfs has support for creating directory but not for files, in order to copy the files low level file opening and writing to file technique is used. [Read More]