Skip to content

Instantly share code, notes, and snippets.

@Lord-Evil
Lord-Evil / httpServer.py
Last active September 7, 2018 14:31
Template for properly multi-threaded python micro-service
#!/usr/bin/python3
import http.server as server
from socketserver import ThreadingMixIn
from urllib.parse import unquote
import json
toJson=json.JSONEncoder()
listen=("0.0.0.0", 7000)
class ThreadedHTTPServer(ThreadingMixIn, server.HTTPServer): pass
class HTTPHandler(server.SimpleHTTPRequestHandler):
const magik = magikcraft.io;
function fly() {
magik.volare();
}
const magik = magikcraft.io;
function fire(name){
magik.incendium(name);
}
const magik = magikcraft.io;
const server = magik.getPlugin().getServer();
const player = magik.getSender();
const world = player.getWorld();
var cursor;
var direction;
function maze() {
var mazeData="XOOXOOOXXOOOOOOXOOOX\nXOXXOXOOXOXXXXOOXXOX\nOOOXOXXOOOOOOXXOXXOX\nOXOXOXXXXXXXOXOOXXOX\nOXOOOXXOOOOXOXOXOOOO\nXOOXXXXOXXOOOXOXXXXO\nXOXOOOXOXOXXXXOXOOOO\nXOXOXOOOXOOXXXOXOXXO\nOOXOXXXXXXOOOOOOOXXO\nOXXOOXXXOOOXXXXXXXOO\nOXOXOXOOOXXOOOOOXOOX\nOOOXOXOXXXXSXXXOOXXX\nXOXOOXOOOOOXXOOXOOOO\nXOXOXXXXXXOOOOXEXXXO\nOOXOOOXOOOXXXOXOXXXO\nOXXXXOOXXOOOXOOOXOOO\nOOOXOXOXXXXOOXOXOOXX\nXXOXOXOXOOOXOOOXOXOO\nXOOOOXOXOXOXXXXXOOOX\nOOXXXXOOOXOOOOOOOXOO";
mazeData=mazeData.split("\n")