Skip to content

Instantly share code, notes, and snippets.

View RafaelWO's full-sized avatar
🤔
thinking...

RafaelWO

🤔
thinking...
  • Salzburg, Austria
  • 17:04 (UTC -12:00)
View GitHub Profile
import datetime
import sys
from typing import Optional
import colorama
import pyramid.config
from loguru import logger
from pyramid.request import Request
from pyramid.response import Response
@andgineer
andgineer / db_fixture.py
Created June 9, 2020 15:38
pytest Fixture to rollback all DB changes after test
from sqlalchemy import event
from sqlalchemy.orm import sessionmaker
from app.db.session import engine
import pytest
import app.tests.config
@pytest.fixture(
scope='function',
autouse=True # New test DB session for each test todo we need it only for tests with Client fixture
@yanqd0
yanqd0 / dl_requests_tqdm.py
Last active May 16, 2024 11:03
Python requests download file with a tqdm progress bar
import requests
from tqdm import tqdm
def download(url: str, fname: str, chunk_size=1024):
resp = requests.get(url, stream=True)
total = int(resp.headers.get('content-length', 0))
with open(fname, 'wb') as file, tqdm(
desc=fname,
total=total,
@tomlankhorst
tomlankhorst / docker-swarm-gpu.md
Last active June 13, 2024 19:00
Instructions for Docker swarm with GPUs
@Rajeshr34
Rajeshr34 / wkhtmltopdf.sh
Last active May 29, 2024 08:44
Wkhtmltopdf With Patched QT Setup Ubuntu 16+
cd ~
apt-get install libfontenc1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig -y
#https://github.com/wkhtmltopdf/wkhtmltopdf/releases
#replace arch
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
apt --fix-broken install
@judy2k
judy2k / parse_dotenv.bash
Created March 22, 2017 13:34
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@roylee0704
roylee0704 / dockergrep.sh
Created December 9, 2016 08:24
how to grep docker log
docker logs nginx 2>&1 | grep "127."
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container
@aiguofer
aiguofer / README.md
Last active April 27, 2023 19:12
Get info about running jupyter notebooks including memory consumption, how long they've been running, etc.