Skip to content

Instantly share code, notes, and snippets.

View worroc's full-sized avatar

Ilya Levin worroc

View GitHub Profile
import asyncio
from functools import wraps, partial
def RequireCapability(cls=None, *, cap=''):
def check_caps(v, cap):
@wraps(v)
async def caps(self, *args, **kwargs):
user_caps = await self._get_capabilities()
if cap not in user_caps:
raise Exception("noooooo")
This file has been truncated, but you can view the full file.
6463 execve("./bin/elasticsearch", ["./bin/elasticsearch"], [/* 103 vars */]) = 0
6463 brk(NULL) = 0xb6e000
6463 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
6463 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
6463 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
6463 fstat(3, {st_mode=S_IFREG|0644, st_size=126280, ...}) = 0
6463 mmap(NULL, 126280, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9b7242b000
6463 close(3) = 0
6463 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
6463 open("/lib/x86_64-linux-gnu/libtinfo.so.5", O_RDONLY|O_CLOEXEC) = 3
import os
from flask import Flask, Response, request, stream_with_context
app = Flask(__name__)
@app.route('/preview', methods=['POST'])
def preview():
handler = Handler(request)
return handler.do()
@worroc
worroc / deleter.py
Last active May 15, 2016 05:22
PubSub access
import gcloud.pubsub
topic_name = "topic_111"
project = "proj"
def delete_topic(client):
topic = client.topic(topic_name)
if topic.exists():
topic.delete()
print ("deleted: %s" % topic_name)
import os
import gcloud.storage
project = "<project-name>"
bucket_name = "artifacts.{project}.appspot.com".format(project=project)
download = False
path_prefix = "" # all returned documents should starts with this.
storage_client = gcloud.storage.Client(project=project)
bucket = storage_client.get_bucket(bucket_name=bucket_name)