Skip to content

Instantly share code, notes, and snippets.

@konradmb
konradmb / linux-usb-file-copy-fix.md
Last active March 9, 2023 03:40 — forked from 2E0PGS/linux-usb-file-copy-fix.md
Fix Ubuntu and other Linux slow/hanging file copying via USB.

If your running a x64 bit Ubuntu or other Linux and find USB transfers hang at the end apply this fix:

echo $((16*1024*1024)) | sudo tee /proc/sys/vm/dirty_background_bytes
echo $((48*1024*1024)) | sudo tee /proc/sys/vm/dirty_bytes

To revert the changes enter this in console

@konradmb
konradmb / generate-thumbnails.py
Last active March 8, 2023 23:25
Generate thumbnails in Gnome
#!/usr/bin/python3
import os
import sys
from concurrent.futures import ThreadPoolExecutor
import gi
from gi.repository import Gio, GnomeDesktop
gi.require_version('GnomeDesktop', '4.0')
@konradmb
konradmb / Containerfile
Created November 17, 2022 00:24
RealESRGAN CPU podman/docker test
FROM ubuntu:22.04
RUN apt update
RUN apt install python3 python3-pip -y
RUN pip3 install realesrgan
RUN apt install -y libgl1 libglib2.0-0
RUN apt install wget -y
RUN wget https://github.com/xinntao/Real-ESRGAN/raw/v0.3.0/inference_realesrgan.py
RUN chmod +x inference_realesrgan.py
RUN python3 inference_realesrgan.py
ENTRYPOINT python3 inference_realesrgan.py -i /img/input -o /img/output --fp32
@konradmb
konradmb / des.nim
Created November 25, 2018 14:54
Nim DES
import strutils
import sequtils
import bitops
import os
import des_utils
type CDTuple = array[17,tuple[c:BitArray,d:BitArray]]
type LRTuple = array[17,tuple[l: bin32,r: bin32]]
@konradmb
konradmb / check-missing-files.sh
Last active September 4, 2015 18:51
Check for missing files from installed APT packages.
#!/bin/bash
#This script checks for missing files, by scanning through lists of installed files in APT package list.
#Sometimes file is listed in APT .list file, but it's not installed by default, so you need to manually
#check if package needs reinstalling or if it's just a normal condition.
#Tested only on Ubuntu 15.04
#This is only very simple check. To test integrity of installed packages, use debsums.
IFS=$'\n'
for file in /var/lib/dpkg/info/*.list