See https://gist.github.com/3449216
$ curl -O http://efele.net/maps/tz/world/tz_world.zip
$ wget http://efele.net/maps/tz/us/tz_us.zip
$ open tz_world.zip
from __future__ import with_statement | |
from kombu import BrokerConnection | |
from collections import defaultdict | |
import gevent | |
from gevent import monkey | |
monkey.patch_all() | |
class WorkerHub(): | |
""" | |
WorkerHub controls the local mailboxes that the @worker decorator assigns. |
def run_seq(cmd): | |
"""Run `cmd` and yield its output lazily""" | |
p = subprocess.Popen( | |
cmd, shell=True, | |
stdin=subprocess.PIPE, | |
stdout=subprocess.PIPE, | |
stderr=subprocess.STDOUT) | |
# make STDIN and STDOUT non-blocking | |
fcntl.fcntl(p.stdin, fcntl.F_SETFL, os.O_NONBLOCK) |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# author: mayli <mayli.he@gmail.com> | |
# | |
# Modified from Pinhole, and the original code is found here: | |
# {{{ http://code.activestate.com/recipes/114642/ (r1) | |
# | |
""" | |
usage: pinhole |
See https://gist.github.com/3449216
$ curl -O http://efele.net/maps/tz/world/tz_world.zip
$ wget http://efele.net/maps/tz/us/tz_us.zip
$ open tz_world.zip
Prefix | Description | Notes | |
---|---|---|---|
sk_live_ | Live secret key | Secret key in a live environment. | |
pk_live_ | Live public key | Public key in a live environment. | |
pst_live_ | Live Connection token | Connection token in a live environment. | |
sk_test_ | Test secret key | Pecret key in a test environment. | |
pk_test_ | Test public key | Public key in a test environment. | |
pst_test_ | Test Connection token | Connection token in a test environment. | |
ac_ | Platform Client ID | Identifier for an auth code/client id. | |
acct_ | Account ID | Identifier for an Account object. | |
ch_ | Charge ID | Identifier for a Charge object. |
#!/bin/bash | |
# Author: Maxwel Leite | |
# Website: http://needforbits.wordpress.com/ | |
# Description: Script to install Microsoft Vista TrueType Fonts (TTF) aka Microsoft’s ClearType fonts on Ubuntu distros | |
# Microsoft added a group of new "ClearType Fonts" to Windows with Windows Vista and Office 2007. | |
# These fonts are named Constantia, Corbel, Calibri, Cambria (and Cambria Math), Candara, and Consolas. | |
# Calibri became the default font on Microsoft Word 2007, and it’s still the default font on Word 2016 today. | |
# Dependencies: wget, fontforge and cabextract | |
# Note: Microsoft no longer provides the PowerPoint Viewer 2007 (v12.0.4518.1014) or any version anymore for download | |
# Tested: Ubuntu Saucy/Trusty/Xenial/Bionic |
import errno | |
import os | |
import paramiko | |
class Uploader(object): | |
def __init__(self, host, basepath='', username=None, password=None, keyfile=None, *args, **kwargs): | |
self.host = host | |
self.basepath = basepath | |
self.username = username |
from flask import request, g | |
from functools import wraps | |
def login_required(f=None, url="public.login", next=None): | |
""" | |
Check if user is logged or redirect to a certain page. | |
By default go to public login. | |
""" | |
def outer_decorator(decorated_fn): |