Skip to content

Instantly share code, notes, and snippets.

View sirkonst's full-sized avatar

Konstantin vz'One Enchant sirkonst

View GitHub Profile
@sirkonst
sirkonst / skip_error.py
Last active May 24, 2016 11:42
Decorator skip_error
class skip_error(object):
def __init__(self, exception, fn=None, default=None):
self.exception = exception
self.fn = fn
self.default = default
def __enter__(self):
return self.default
@sirkonst
sirkonst / constants.py
Last active May 26, 2016 13:06
Easy define python constants type.
class Constants(type):
class _ConstantsBase(dict):
def __getattribute__(self, name):
try:
return self[name]
except LookupError:
raise AttributeError(name)
@sirkonst
sirkonst / states.state.py
Created March 2, 2012 07:27
State of states module for salt (saltstack)
"""
State module
============
The state module for logical union of several states.
Available Functions
-------------------
@sirkonst
sirkonst / states.state.py
Created February 24, 2012 13:20
State of states module for salt (saltstack)
"""
State module
============
The state module for logical union of several states.
Available Functions
-------------------
@sirkonst
sirkonst / gsdproxy.py
Created November 10, 2011 07:32 — forked from ncode/gsdproxy.py
gevent simple dynamic reverse proxy
#!/usr/bin/env python
from gevent import monkey
monkey.patch_all()
import sys
import redis
import urllib2
import traceback
from cgi import escape
# -- gsdproxy