Hierarchical data metrics that allows fast read operations on tree like structures.
Based on Left and Right fields that are set during tree traversal. When entered into node value is set to it's Left, when exiting node value is set to it's Right.
# NB: you need to have ubuntu 16.04 for install last version of bucardo, with 14.04 apt installs version 4.xx | |
apt-get update | |
apt-get install bucardo nano -y | |
mkdir /srv/bucardo | |
mkdir /var/run/bucardo | |
service postgresql start |
from flask import Flask, g, jsonify | |
import werkzeug, os | |
from werkzeug.utils import secure_filename | |
import psycopg2 | |
from psycopg2 import pool | |
def get_db(): | |
print ('GETTING CONN') | |
if 'db' not in g: |
Hierarchical data metrics that allows fast read operations on tree like structures.
Based on Left and Right fields that are set during tree traversal. When entered into node value is set to it's Left, when exiting node value is set to it's Right.
# ---- Base python ---- | |
FROM python:3.6 AS base | |
# Create app directory | |
WORKDIR /app | |
# ---- Dependencies ---- | |
FROM base AS dependencies | |
COPY gunicorn_app/requirements.txt ./ | |
# install app dependencies | |
RUN pip install -r requirements.txt |
package main | |
import ( | |
"flag" | |
"log" | |
"os" | |
"os/signal" | |
"syscall" | |
"time" |
from threading import Timer | |
from functools import partial | |
class Interval(object): | |
def __init__(self, interval, function, args=[], kwargs={}): | |
""" | |
Runs the function at a specified interval with given arguments. | |
""" | |
self.interval = interval |
import asyncio | |
import threading | |
import random | |
def thr(i): | |
# we need to create a new loop for the thread, and set it as the 'default' | |
# loop that will be returned by calls to asyncio.get_event_loop() from this | |
# thread. | |
loop = asyncio.new_event_loop() |
import asyncio | |
from django import http | |
from django.core.urlresolvers import set_script_prefix | |
from django.utils.encoding import force_str | |
from django.core.handlers.wsgi import get_script_name | |
from django_wsgi.handler import DjangoApplication | |
import logging | |
import logging | |
import sys |
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required |
def clean_html(content): | |
import re | |
TAG_RE = re.compile(r'<[^>]+>') | |
return TAG_RE.sub('', content).strip() |