This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lxml.html import clean | |
class Bleacher(clean.Cleaner): | |
safe_attrs_only = True | |
safe_attrs = frozenset([ | |
'abbr', 'accept', 'accept-charset', 'accesskey', 'action', 'align', | |
'alt', 'axis', 'border', 'cellpadding', 'cellspacing', 'char', 'charoff', | |
'charset', 'checked', 'cite', 'class', 'clear', 'cols', 'colspan', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
import functools | |
import hashlib | |
import logging | |
import tornado.web | |
import tornado.gen | |
import tornado.httpclient | |
import tornado.ioloop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func fibgen() func() { | |
a, b := 0, 1 | |
return func() { | |
sum := a + b | |
fmt.Println(sum) | |
a, b = b, sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function version_tag() { | |
# Script automatically increments revision in REVISION file. | |
# Creates tag and pushes it to git origin for deploy. | |
if [ ! -d .git ]; then | |
echo "not a git repo" | |
return | |
fi | |
if [ ! -f REVISION ]; then | |
# create REVISION file with zero version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# | |
# Copyright (c) Alexandr Emelin. BSD license. | |
# All rights reserved. | |
# | |
""" | |
class GithubAuthHandler(BaseHandler, auth.GithubMixin): | |
x_site_token = 'application' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
from tornado.gen import Task, Return, coroutine | |
import tornado.process | |
from tornado.ioloop import IOLoop | |
import subprocess | |
import time | |
STREAM = tornado.process.Subprocess.STREAM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
zmq "github.com/alecthomas/gozmq" | |
"log" | |
) | |
var xpub = flag.String("xpub", "tcp://*:6001", "ZeroMQ XPUB socket address") | |
var xsub = flag.String("xsub", "tcp://*:6000", "ZeroMQ XSUB socket address") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# client for tarantool's queue | |
# https://github.com/tarantool/queue | |
# usage: | |
# queue = Queue("127.0.0.1", 12013) | |
# queue.put(data={"foo":"bar"}) | |
# task = queue.take() | |
import tarantool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# bleach==1.2.2 | |
# beautifulsoup4==4.3.2 | |
from bleach import clean | |
from bs4 import BeautifulSoup | |
ALLOWED_TAGS = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |