Skip to content

Instantly share code, notes, and snippets.

View direct-fuel-injection's full-sized avatar
🔞
Working from home

Aleksei Minin direct-fuel-injection

🔞
Working from home
View GitHub Profile
@direct-fuel-injection
direct-fuel-injection / lock.py
Last active October 26, 2015 08:22
Cherrypy tool for exclusive lock. MethodDispatcher.
# -*- coding: utf-8 -*-
import cherrypy
from random import randint
from fcntl import flock, LOCK_EX, LOCK_UN
__all__ = ["LockTool"]
class LockTool(cherrypy.Tool):
def __init__(self):
@direct-fuel-injection
direct-fuel-injection / redis.py
Created October 26, 2015 08:19
Cherrypy Redis Sessions on cherrys lib.
# -*- coding: utf-8 -*-
import cherrypy
import datetime
from cherrys import RedisSession
try:
import simplejson as json
except ImportError:
import json
@direct-fuel-injection
direct-fuel-injection / artists.py
Created September 23, 2015 06:54
Cherrypy REST API example without MethodDispatcher.
# -*- coding: utf-8 -*-
try: import simplejson as json
except ImportError: import json
import cherrypy
from mapper import Mapper
@cherrypy.popargs('songid')
class Artists(Mapper):