This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from plugin import TraceParentLogger | |
def create_app(): | |
config = get_api_settings() | |
app = FastAPI... | |
.... | |
app.add_middleware(RawContextMiddleware, plugins=(TraceParentLogger(),) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.9.5-slim-buster | |
ENV PYTHONUNBUFFERED 1 | |
RUN adduser \ | |
--disabled-password \ | |
--gecos "" \ | |
--home /app \ | |
app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python3 script to determine | |
# 1 flash, 1 bit bright,3 bits paper,3 bits ink | |
if __name__ == '__main__': | |
colors = { | |
"INK_BLACK": 0x00, | |
"INK_BLUE": 0x01, | |
"INK_RED": 0x02, | |
"INK_MAGENTA": 0x03, | |
"INK_GREEN": 0x04, | |
"INK_CYAN": 0x05, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Converts in batch 7zip files to zip | |
""" | |
import zipfile | |
import glob | |
from io import BytesIO | |
import argparse | |
# Uncomment to use macos hack brew version of of libarchive | |
# import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
until nc -nz $1 22 -w 5 &>/dev/null; do :; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Obtained from | |
https://stackoverflow.com/questions/41564291/parquet-build-with-hdfs-getmerge-recovery | |
""" | |
import sys | |
import locale | |
import os | |
import re | |
import io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Executing a new task periodically in celery like in java quartz, is as simple as: | |
0) Define your tasks in a dictionary (function check_users in background_tasks module will execute every half an hour): | |
beat_schedule = { | |
'check_users': { | |
task: 'backoffice.blueprints.users.background_tasks.check_users' | |
schedule: 1800.0 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from distutils.version import StrictVersion | |
class User(object): | |
def __init__(self, version='2.0.0'): | |
self.app_version = version | |
class UserArgument(User): | |
COMPATIBLE_TYPE=User | |
def __init__(self, input): | |
self.applies = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.stopWords = 'a,an,as,at,before,but,by,for,from,is,in,into,like,of,off,on,onto,per,since,than,the,this,that,to,up,via,with'; | |
String.escapeRegExp = function(str) { | |
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); | |
}; | |
String.prototype.replaceAll = function (find, replace) { | |
return this.replace(new RegExp(String.escapeRegExp(find), 'g'), replace); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Welcome to BrowserId. | |
This module provides a 'Login' button inside login form and a configurable block. | |
It also defines a Permission called 'log in using browserid', which needs to be enabled for anonymous role in order to show the Login buttons. |
NewerOlder