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
# coding: utf-8
#
# Copyright (c) Alexandr Emelin. BSD license.
# All rights reserved.
#
"""
class GithubAuthHandler(BaseHandler, auth.GithubMixin):
x_site_token = 'application'
# coding: utf-8
#
# Copyright (c) Alexandr Emelin. BSD license.
# All rights reserved.
#
"""
class GithubAuthHandler(BaseHandler, auth.GithubMixin):
x_site_token = 'application'
@ego008
ego008 / supervisord.sh
Created November 1, 2015 02:55 — forked from danmackinlay/supervisord.sh
an init.d script for supervisord
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@ego008
ego008 / ubuntu-php7-install.bash
Last active July 6, 2016 02:54
Ubuntu 14.04 PHP7 (Install from Source)
#!/usr/bin/env bash
sudo -i;
apt-get update;
apt-get install --yes \
git \
bison \
autoconf \
@ego008
ego008 / index.html
Created December 16, 2015 09:24 — forked from CodeMyUI/index.html
Material Design Register Login Form
<div class="materialContainer">
<div class="box">
<div class="title">LOGIN</div>
<div class="input">
<label for="name">Username</label>
<input type="text" name="name" id="name">
@ego008
ego008 / nginx
Created April 23, 2016 07:16 — forked from vdel26/nginx
Openresty init.d script
#!/bin/sh
#
# chkconfig: 2345 55 25
# Description: Nginx init.d script, put in /etc/init.d, chmod +x /etc/init.d/nginx
# For Debian, run: update-rc.d -f nginx defaults
# For CentOS, run: chkconfig --add nginx
#
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
@ego008
ego008 / tornado_asyncio.py
Created August 15, 2016 07:07 — forked from drgarcia1986/tornado_asyncio.py
Tornado and Asyncio Mixed example
# -*- coding: utf-8 -*-
import asyncio
import re
import asyncio_redis
import tornado.concurrent
import tornado.httpclient
import tornado.web
import tornado.platform.asyncio
@ego008
ego008 / start-stop-example.sh
Created October 21, 2016 01:48 — forked from alobato/start-stop-example.sh
start-stop-example
#!/bin/sh
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh
set -e
# Must be a valid filename
NAME=foo
PIDFILE=/var/run/$NAME.pid
#This is the command to be run, give the full pathname
DAEMON=/usr/local/bin/bar
@ego008
ego008 / aiohttp+websockets.md
Created October 28, 2016 02:03
aiohttp server with websocket

** aiohttp now supports in its webframework websocket **

http://aiohttp.readthedocs.org/en/v0.14.1/web.html#websockets

This is a quick hack (ported from django-c10k) to get websocket working along side classic http with aiohttp web server. I think it would be better to inherit the aiohttp.web.RequestHandler and add the code to handle the upgrade in RequestHandler.start instead of overriding RequestHandler.transport.close in WebsocketResponse.

Anyway, it seems like it works.

requirements:

#!/usr/bin/env python
# coding:utf-8
import _env
from time import time
from urllib import urlencode
from urllib2 import urlopen as urlopen2
from urlparse import parse_qsl
from hashlib import md5
from urlgrabber import urlopen
import errno