Skip to content

Instantly share code, notes, and snippets.

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

Rafael Weingartner-Ortner RafaelWO

🤔
thinking...
View GitHub Profile
@RafaelWO
RafaelWO / check-emudhra-patch-status.sh
Last active November 14, 2026 08:54
A script to check if your Linux machine trusts compromised eMudhra intermediate CA certificates and which installed apps/tools might need patching. App versions are taken from https://emudhra.we-have-a-problem.com.
#!/usr/bin/env bash
#
# check-emudhra-patch-status.sh
#
# Reports whether this machine still trusts the compromised eMudhra
# intermediate CA certificates, and which installed tools still need
# patching. Read-only: nothing is installed, downloaded, modified or
# deleted.
#
# Run with --help for the verdicts, the options and what the probe sends.
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
@matthiasr
matthiasr / gpg_wsl2.md
Last active October 1, 2026 16:48
GPG signing with full gpg-agent support in WSL2: the easy way

Problem statement

Signing with GPG in Windows System for Linux (WSL2) does not work smoothly out of the box. Notably, when using a TTY-based pinentry, signing in Visual Studio Code does not work at all.

Solution

  1. Install Gpg4Win: winget install -e GnuPG.Gpg4win or download and install manually
  2. Start Kleopatra and generate or import keys
  3. Insert links to gpg.exe inside of WSL:
@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 November 15, 2025 15:24
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 July 4, 2026 16:41
Instructions for Docker swarm with GPUs
@rubo77
rubo77 / rotatescreen.sh
Last active April 2, 2025 08:31
This script rotates the screen (tested on a Lenovo Yoga 730-15iwl) (source: https://askubuntu.com/a/1217290/34298)
#!/bin/bash
# This script rotates the screen and touchscreen
# by Ruben Barkow-Kuder: https://gist.github.com/rubo77/daa262e0229f6e398766
#### configuration
# find your Touchscreen device with `xinput`
TouchscreenDevice="$(xrandr |grep eDP|cut -d" " -f1)"
if [ "$1" = "--help" ] || [ "$1" = "-h" ] ; then
@gene1wood
gene1wood / aws-lambda-relative-import-no-known-parent-package.md
Last active August 20, 2025 06:59
Python relative imports in AWS Lambda fail with `attempted relative import with no known parent package`

Python relative imports in AWS Lambda fail with attempted relative import with no known parent package

The Problem

In AWS Lambda if I attempt an explicit relative import like this

.
├── lambda_file.py
└── example.py
@dazza-codes
dazza-codes / check_numpy_types.md
Last active January 13, 2025 12:59
Checking numpy types
@Rajeshr34
Rajeshr34 / wkhtmltopdf.sh
Last active June 23, 2025 09:38
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