Skip to content

Instantly share code, notes, and snippets.

View namper's full-sized avatar
🔁
Reindexing

Mishiko (მიშო) namper

🔁
Reindexing
  • Tbilisi, Georgia (საქართველო)
  • 15:41 (UTC +04:00)
View GitHub Profile
open Printf
exception Goto of string
let label (name: string) = ()
let goto (name: string) = raise (Goto name)
let goto_block (blocks: (string * (unit -> unit)) list): unit =
let rec goto_block_impl (name: string option): unit =
try
@speedplane
speedplane / celery_app.py
Created October 25, 2017 02:02
Celery Autoscaler Based on Memory and System Load
import multiprocessing
import re
from celery import Celery
from celery.worker.autoscale import Autoscaler as CeleryAutoscaler
class DAAutoscaler(CeleryAutoscaler):
# Try to keep the load above this point.
LOAD_MIN = .8
# Try to keep the load below this.
LOAD_MAX = 1.1
@latsa
latsa / private.py
Created February 17, 2017 23:19
Python @Private decorator
import sys, functools
def private(member):
@functools.wraps(member)
def wrapper(*function_args):
myself = member.__name__
caller = sys._getframe(1).f_code.co_name
if (not caller in dir(function_args[0]) and not caller is myself):
raise Exception("%s called by %s is private"%(myself,caller))
return member(*function_args)