Skip to content

Instantly share code, notes, and snippets.

View ego008's full-sized avatar
๐Ÿ 
Working from home

Ybb ego008

๐Ÿ 
Working from home
View GitHub Profile
@ego008
ego008 / make_safely_shutdown.py
Created December 26, 2018 12:30 — forked from nicky-zs/make_safely_shutdown.py
Make the tornado httpserver.HTTPServer to be shutdown safely.
# vim: fileencoding=utf-8
import time, signal
from tornado import web, ioloop, options, httpserver
_SHUTDOWN_TIMEOUT = 30
def make_safely_shutdown(server):
io_loop = server.io_loop or ioloop.IOLoop.instance()
def stop_handler(*args, **keywords):
def shutdown():
@ego008
ego008 / gist:52aa72ffdbd41ff33af99260b0e26f2e
Last active December 26, 2018 11:51 — forked from methane/gist:2185380
Tornado Example: Delegating an blocking task to a worker thread pool from an asynchronous request handler
import time
import tornado
from tornado.concurrent import run_on_executor
from concurrent.futures import ThreadPoolExecutor # `pip install futures` for python2
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.web import Application, RequestHandler
from tornado import gen
import asyncio
import base64
import hashlib
from japronto.app import Application
class NaiveWsBaseProtocol(asyncio.Protocol):
@staticmethod
def accept(key):
@ego008
ego008 / gchart_offline.html
Created November 27, 2018 12:35 — forked from makevoid/gchart_offline.html
GChart offline example
<!--
How to use Google JS Visualization Api offline, step by step
this approach might work with other libraries loaded with google.load, after all it's still JavaScript!!!
-->
<!DOCTYPE html>
<html>
@ego008
ego008 / unixhttpc.go
Created July 11, 2018 08:02 — forked from teknoraver/unixhttpc.go
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"
package main
import (
agwd "github.com/sclevine/agouti"
tbwd "github.com/tebeka/selenium"
"log"
sgwd "sourcegraph.com/sourcegraph/go-selenium"
)
// Helper for sourcegraph/go-selenium
@ego008
ego008 / get.js
Created May 12, 2018 11:19 — forked from rafaelstz/get.js
AJAX GET and POST with pure Javascript
// Exemplo de requisiรงรฃo GET
var ajax = new XMLHttpRequest();
// Seta tipo de requisiรงรฃo e URL com os parรขmetros
ajax.open("GET", "minha-url-api.com/?name=Henry&lastname=Ford", true);
// Envia a requisiรงรฃo
ajax.send();
// Cria um evento para receber o retorno.
@ego008
ego008 / tlsprox.go
Created May 8, 2018 13:17 — forked from tam7t/tlsprox.go
Minimal TLS MITM transparent proxy
/* tlsprox - minimal tls MITM transparent proxy... in go!
* by @tam7t
*
* Usage:
* If we want to MITM https://example.com first get example.com's ip address
* then add localhost to /etc/hosts:
*
* 127.0.0.1 example.com
*
* > go build tlsprox.go
@ego008
ego008 / gist:69d30f9fef380eda6d4ed31b88845433
Created February 27, 2018 12:46 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: ๐Ÿ˜„ :smile: ๐Ÿ˜† :laughing:
๐Ÿ˜Š :blush: ๐Ÿ˜ƒ :smiley: โ˜บ๏ธ :relaxed:
๐Ÿ˜ :smirk: ๐Ÿ˜ :heart_eyes: ๐Ÿ˜˜ :kissing_heart:
๐Ÿ˜š :kissing_closed_eyes: ๐Ÿ˜ณ :flushed: ๐Ÿ˜Œ :relieved:
๐Ÿ˜† :satisfied: ๐Ÿ˜ :grin: ๐Ÿ˜‰ :wink:
๐Ÿ˜œ :stuck_out_tongue_winking_eye: ๐Ÿ˜ :stuck_out_tongue_closed_eyes: ๐Ÿ˜€ :grinning:
๐Ÿ˜— :kissing: ๐Ÿ˜™ :kissing_smiling_eyes: ๐Ÿ˜› :stuck_out_tongue:
@ego008
ego008 / server.py
Created February 25, 2018 07:59 — forked from seriyps/server.py
TornadoWEB streaming file server
# -*- coding: utf-8 -*-
'''
Created on 2012-09-24
@author: Sergey <[email protected]>
How to test:
$ head -c 100M /dev/urandom > static_file.bin
$ python