Skip to content

Instantly share code, notes, and snippets.

View michaelkuty's full-sized avatar

Michael Kutý michaelkuty

View GitHub Profile
@michaelkuty
michaelkuty / gist:6845607
Created October 5, 2013 20:23
simple add file to exist issue in redmine
import requests
import json
url = 'http://jachym-redmine.samsung.majklk.cz'
auth = {'key':'008e507cf5bffac1f5df822d8cb3465170813b09'}
#filename relative path
#issue=issue_id = String !!
#item {"name":"test.jpeg", "description":"","content-Type":"image/png"path:"/srv/jachym/bin/"}
@michaelkuty
michaelkuty / Actions.py
Last active September 9, 2015 15:43
full implementation bootstrap pagination datatable for openstack horizon
class BaseFilterAction(tables.FilterAction):
"""filter action for search in all available columns
.. attribute:: custom_field
Custom field for search. Default is all fields.
"""
needs_preloading = True
@michaelkuty
michaelkuty / gist:57ac40950a77ab900336
Created August 21, 2014 20:58
horizon auto overrides
def auto_overrides(app):
module_name = "%s.%s" % (app, "overrides")
try:
mod = __import__(module_name)
except Exception, e:
pass
for app in settings.INSTALLED_APPS:
auto_overrides(app)
@michaelkuty
michaelkuty / tasks.py
Last active October 9, 2015 13:29
save output from celery tasks
import functools
import sys
from StringIO import StringIO
def catch_result(task_func):
"""Catch printed result from Celery Task and return it in task response
"""
@michaelkuty
michaelkuty / request.js
Last active January 6, 2016 17:14
Simple HTTP client in JS for NodeJS
var request = require('request');
var rp = require('request-promise');
export default function Model(model) {
/* Encapsulate Django Rest Frameowork actions
var page = new Model('web.page');
page.list(function (pages) {
@michaelkuty
michaelkuty / flask.py
Created January 9, 2016 17:21
Salt Master Flask server
from flask import jsonify
from flask import Flask
from flask import request
import yaml
app = Flask(__name__)
@app.route("/<path:path>", methods=['POST'])
def dump_relass(path):
@michaelkuty
michaelkuty / deploy-site.sh
Last active September 12, 2016 11:48
Deploy leonardo site
#!/bin/bash -e
pip_install_source()
{
REMOTE=$1
EGG=$2
[ -d ../src ] || mkdir ../src
git clone $REMOTE --depth 1 ../src/$EGG
@michaelkuty
michaelkuty / jinja_renderer.py
Last active July 19, 2016 13:54
Simple Jinja renderer
import jinja2
from jinja2 import Environment
import yaml
jinja2.filters.FILTERS['yaml'] = lambda s: yaml.safe_dump(
s, default_flow_style=True)
jinja2.filters.FILTERS['parse_aliases'] = lambda s: yaml.safe_dump(
s.split(','), default_flow_style=True)
@michaelkuty
michaelkuty / run-tests.sh
Last active August 1, 2016 07:37
PerfKit Benchmark Stages
#!/bin/bash
run_tests() {
[ -d ./results/$CLOUD/$TEST ] || mkdir -p ./results/$CLOUD/$TEST
# run provision and preparation before run
echo "Start preparing environemnt for $TEST in the $CLOUD"
#requires -version 2
#------------------------------------------------------------------------------
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true)]
[Guid] $StampId,
[Parameter(Mandatory=$true)]
[int32] $Size,