Skip to content

Instantly share code, notes, and snippets.

View Keda87's full-sized avatar
:shipit:
Hmmmm

Adiyat Mubarak Keda87

:shipit:
Hmmmm
View GitHub Profile
@Keda87
Keda87 / install_bucardo.sh
Created October 5, 2023 04:22 — forked from Leen15/install_bucardo.sh
step by step for install a bucardo instance
# 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
@Keda87
Keda87 / run.py
Created June 28, 2022 08:21 — forked from vulcan25/run.py
psycopg2 flask implementation with connection pooling support
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:
@Keda87
Keda87 / README.md
Created March 30, 2022 02:35 — forked from tmilos/README.md
Modified Preorder Tree Traversal

Modified Preorder Tree Traversal

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.

Sample implementation

# ---- 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
@Keda87
Keda87 / main.go
Created August 14, 2020 16:06 — forked from spksoft/main.go
Example Golang worker with rabbitMQ graceful shutdown
package main
import (
"flag"
"log"
"os"
"os/signal"
"syscall"
"time"
@Keda87
Keda87 / interval.py
Created January 19, 2020 14:29 — forked from bbengfort/interval.py
Run a function every n seconds using Python threading.
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
@Keda87
Keda87 / asyncio_loops.py
Created January 14, 2020 03:21 — forked from lars-tiede/asyncio_loops.py
asyncio + multithreading: one asyncio event loop per thread
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()
@Keda87
Keda87 / async_app.py
Created February 5, 2019 13:21 — forked from zbyte64/async_app.py
Asyncio Views With Django
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
@Keda87
Keda87 / .vimrc
Last active July 18, 2019 14:37
My simple vim setup
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
@Keda87
Keda87 / clean_html.py
Created February 23, 2018 09:38
Clean up html tags within text
def clean_html(content):
import re
TAG_RE = re.compile(r'<[^>]+>')
return TAG_RE.sub('', content).strip()