Skip to content

Instantly share code, notes, and snippets.

@Lothiraldan
Lothiraldan / fabfile.py
Created February 7, 2014 13:31
FabFile for creating VagrantFile using salt provisionner with pregenerated keys
"""Deployment tasks using fabric
"""
import sys
from os.path import join, abspath, dirname, expanduser, exists, normpath
from fabric.api import prompt, env, sudo, put, task, local, run, cd
# from settings import settings
from fabric.colors import green, red
from shutil import copy
from tornado.platform.asyncio import AsyncIOMainLoop
import asyncio
import tornado
import tornado.web
import tornado.gen
from inspect import isgeneratorfunction, isgenerator
AsyncIOMainLoop().install()
loop = asyncio.get_event_loop()
def recv_future(zmqstream):
''' Retruns future for recv on zmqstream
'''
future = Future()
def _finish(reply):
future.set_result(reply)
zmqstream.on_recv(_finish)
@Lothiraldan
Lothiraldan / gist:2c9a0f77aa64fc87079f
Created November 28, 2014 11:40
Oracle java 7 auto-accept SaltStack
{% if grains.os_family == 'Debian' %}
java7_read_license:
cmd.run:
- name: "echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections"
- unless: 'debconf-get-selections | grep "shared/accepted-oracle-license-v1-1"'
- require:
- pkg: debconf-utils
- require_in:
- pkg: java7_packages
@Lothiraldan
Lothiraldan / gist:7c295329e7ec4a04d423
Created April 11, 2015 16:26
Function call in traceback detection
import inspect
import sys
def _get_code_id(callable):
if inspect.ismethod(callable):
return id(callable.im_func.func_code)
elif inspect.isfunction(callable):
return id(callable.func_code)
from flask import Flask, render_template
app = Flask(__name__)
def gen_page(page):
def endpoint():
return render_template(page, page_name=page)
endpoint.__name__ = page
import asyncio
from aiohttp.web import Application, Response
@asyncio.coroutine
def resource(request):
return Response(text=repr(request.match_info))
@asyncio.coroutine
@Lothiraldan
Lothiraldan / pelican.patch
Created April 6, 2011 07:53
Add support for translations into notmyidea-cms theme
We couldn’t find that file to show.
@Lothiraldan
Lothiraldan / gist:905361
Created April 6, 2011 08:58
Omission of article_infos in index template
From 28011b22beb3da18c3b1cc863cd415fffb4c40d7 Mon Sep 17 00:00:00 2001
From: FELD Boris <lothiraldan@gmail.com>
Date: Wed, 6 Apr 2011 10:52:51 +0200
Subject: [PATCH 2/2] Omission of article_infos in index template
---
notmyidea-cms/templates/index.html | 13 +------------
1 files changed, 1 insertions(+), 12 deletions(-)
diff --git a/notmyidea-cms/templates/index.html b/notmyidea-cms/templates/index.html
@Lothiraldan
Lothiraldan / gist:905362
Created April 6, 2011 09:01
Move articles infos into article_infos template
From a2eb43ec131512743f2a61d3e382dbc3dda26576 Mon Sep 17 00:00:00 2001
From: FELD Boris <lothiraldan@gmail.com>
Date: Wed, 6 Apr 2011 10:21:09 +0200
Subject: [PATCH] Move articles infos into article_infos template
---
notmyidea-cms/templates/article.html | 14 +-------------
notmyidea-cms/templates/article_infos.html | 14 ++++++++++++++
notmyidea-cms/templates/index.html | 15 +--------------
3 files changed, 16 insertions(+), 27 deletions(-)