Skip to content

Instantly share code, notes, and snippets.

View casesolved-co-uk's full-sized avatar
💭
Open for business

Richard Case casesolved-co-uk

💭
Open for business
View GitHub Profile
@casesolved-co-uk
casesolved-co-uk / docker.sh
Created February 22, 2026 02:29
How to export and import a set of images and containers in docker to change storage driver to btrfs
# export script for currently running containers
# You have to compile python >3.9, create venv, activate, install poetry, clone the autocompose git repo
docker save -o /opt/all-images.tar $(docker images --format '{{.Repository}}:{{.Tag}}')
cd /root/docker-autocompose; poetry run autocompose $(docker ps -aq) > /opt/compose.yml
# for loading and starting saved containers and images
docker load -i /opt/all-images.tar
docker compose -f /opt/compose.yml up -d
@casesolved-co-uk
casesolved-co-uk / werkzeug
Created January 25, 2025 21:19
Werkzeug problem
# python
@local_manager.middleware
@Request.application
def application(request: Request):
# gunicorn error
Traceback (most recent call last):
File "/home/rich/v14/env/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 134, in handle
self.handle_request(listener, req, client, addr)
File "/home/rich/v14/env/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 177, in handle_request
@casesolved-co-uk
casesolved-co-uk / opencore-T470s-minimal.txt
Created September 12, 2024 01:52
Opencore hackintosh 1st sparse EFI attempt - boot loop
00:000 00:000 BS: Starting OpenCore application...
00:000 00:000 BS: Booter path - \EFI\BOOT\BOOTX64.EFI
00:000 00:000 OCFS: Trying to locate filesystem on D5129218 D5101F98
00:000 00:000 OCFS: Filesystem DP - \EFI\BOOT\BOOTX64.EFI
00:000 00:000 BS: Trying to load OpenCore image...
00:000 00:000 BS: Relative path - EFI
00:000 00:000 BS: Startup path - EFI\OpenCore.efi (0)
00:000 00:000 BS: Fallback to absolute path - EFI\OC\OpenCore.efi
00:000 00:000 BS: Read OpenCore image of 843776 bytes
00:000 00:000 OCM: Loaded image at D5101918 handle
@casesolved-co-uk
casesolved-co-uk / opencore.txt
Created September 12, 2024 00:39
Hackintosh Lenovo T470s fail to install - after a while outputs garbage to log and complains a lot about NVMe and GXBI I think
00:000 00:000 BS: Starting OpenCore application...
00:000 00:000 BS: Booter path - \EFI\BOOT\BOOTX64.EFI
00:000 00:000 OCFS: Trying to locate filesystem on D5129218 D5101F98
00:000 00:000 OCFS: Filesystem DP - \EFI\BOOT\BOOTX64.EFI
00:000 00:000 BS: Trying to load OpenCore image...
00:000 00:000 BS: Relative path - EFI
00:000 00:000 BS: Startup path - EFI\OpenCore.efi (0)
00:000 00:000 BS: Fallback to absolute path - EFI\OC\OpenCore.efi
00:000 00:000 BS: Read OpenCore image of 845400 bytes
00:000 00:000 OCM: Loaded image at D5100E98 handle
@casesolved-co-uk
casesolved-co-uk / ssh-git.sh
Created August 25, 2024 22:41
Shell file for creating git server - restricts ssh commands to git only (probably not totally secure)
#!/bin/bash
# To force particular keys to only use git, prefix their entry on authorized_keys with:
# command="/home/user/ssh-git.sh" ssh-ed25519 AAAAC3NzaC....
# Only allows git commands
if [ -z "$SSH_ORIGINAL_COMMAND" ] || [ "$SSH_ORIGINAL_COMMAND" = "${SSH_ORIGINAL_COMMAND#git-}" ]; then
echo "Sorry, only git allowed"
else
client_arr=( ${SSH_CLIENT} )
client_ip=${client_arr[0]}
@casesolved-co-uk
casesolved-co-uk / colab_gdrive.py
Created May 12, 2024 07:11
Google Colab local runtime Google Drive upload and download using pydrive2
class GDrive:
"""
Class that allows file upload and download from a 'mounted' GDrive folder
using pydrive2 in a local Google colab runtime
Usage:
First create and copy your settings.yaml according to this:
https://docs.iterative.ai/PyDrive2/oauth/
Then copy this code as a file and import or copy/paste
@casesolved-co-uk
casesolved-co-uk / Comparison Espressif ESP MCUs.md
Created October 25, 2023 11:55 — forked from sierses/Comparison Espressif ESP MCUs.md
Comparison table for ESP8266/ESP32/ESP32-S2/ESP32-S3/ESP32-C3/ESP32-C6

Comparison table for ESP8266/ESP32/ESP32-S2/ESP32-S3/ESP32-C3/ESP32-C6

A minimal table to compare the Espressif's MCU families.

ESP8266 ESP32 ESP32-S2 ESP32-S3 ESP32-C3 ESP32-C6
Announcement Date 2014, August 2016, September 2019, September 2020, December
@casesolved-co-uk
casesolved-co-uk / swap.sh
Created May 7, 2023 14:08
Linux swap usage by process
#!/bin/bash
# Get current swap usage for all running processes
# Erik Ljungstrom 27/05/2011
# Modified by Mikko Rantalainen 2012-08-09
# Pipe the output to "sort -nk3" to get sorted output
# Modified by Marc Methot 2014-09-18
# removed the need for sudo
SUM=0
OVERALL=0
@casesolved-co-uk
casesolved-co-uk / domain_search.sh
Last active March 11, 2023 12:44
brute force all subdomain names using dig up to certain length
#!/usr/bin/env bash
# Copyright (c) 2023, CaseSolved.co.uk
if [ -z "$1" ]; then
echo "supply hostname character length"
exit 1
fi
clength="$1"
if [ -z "$2" ]; then
@casesolved-co-uk
casesolved-co-uk / server-rclone.sh
Last active February 15, 2023 14:40
Whole linux server offsite backup using rclone (Ubuntu 22.04)
#!/usr/bin/env bash
# Copyright (c) 2023, CaseSolved.co.uk
# Whole linux server offsite backup using rclone (Ubuntu 22.04)
# tar should achieve roughly 50% compression
read -r -d "" usage << EOM
arg1: rclone remote
arg2: remote directory
optional: