Skip to content

Instantly share code, notes, and snippets.

View tremby's full-sized avatar

Bart Nagel tremby

View GitHub Profile
Running Steam on ubuntu 18.04 64-bit
STEAM_RUNTIME is enabled automatically
Pins up-to-date!
/home/bjn/.local/share/Steam/ubuntu12_32/steam
ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
Installing breakpad exception handler for appid(steam)/version(1581460722)
Installing breakpad exception handler for appid(steam)/version(1581460722)
Gtk-Message: Failed to load module "gail"
Gtk-Message: Failed to load module "atk-bridge"
@tremby
tremby / fromro.py
Created May 4, 2020 15:37
Convert text from RISC OS encoding to UTF-8
#!/usr/bin/env python3
"""
Convert stdin (text in the standard RISC OS character set) to UTF-8
See https://en.wikipedia.org/wiki/RISC_OS_character_set#Code_page_layout_(standard)
"""
import sys
@tremby
tremby / mpro-to-gmail.md
Created May 3, 2020 20:05
Migrating email from Messenger Pro (or probably any other IMAP server) to Gmail

Migrating email from any IMAP server to Gmail

I recently needed to move some large archives of email from Messenger Pro on RISC OS to Gmail. I tried a lot of different approaches, and finally come up with a solution I believe to be the most reliable and least error-prone, using OfflineIMAP.

Using OfflineIMAP has its own set of difficulties, but I think it's much more bulletproof a solution overall than the others I tried, such

@tremby
tremby / progress.py
Last active November 16, 2021 21:09
Progress bar for anything
#!/usr/bin/env python3
"""
Get a progress bar for anything.
Feed this script a line containing two numbers on standard input as often or
infrequently as you like.
It will give you a progress bar and, once at least two readings have been taken,
estimated time remaining.
@tremby
tremby / syslog
Created August 22, 2019 15:59
hibernation issue: syslog
# 08:10:01 from multiple-cold-boot-in-a-row state, poweroff
Aug 22 08:10:01 laptop systemd[1]: Stopping LVM2 PV scan on device 253:0...
Aug 22 08:10:01 laptop systemd[1]: Stopped target Timers.
Aug 22 08:10:01 laptop systemd[1]: Stopped Message of the Day.
Aug 22 08:10:01 laptop systemd[1]: Stopped Daily Cleanup of Temporary Directories.
Aug 22 08:10:01 laptop systemd[1]: Removed slice system-getty.slice.
Aug 22 08:10:01 laptop systemd[1]: Stopping RealtimeKit Scheduling Policy Service...
Aug 22 08:10:01 laptop systemd[1]: Stopped Clean PHP session files every 30 mins.
Aug 22 08:10:01 laptop systemd[1]: Stopped target Sound Card.
@tremby
tremby / number-to-words.js
Last active May 6, 2019 20:13
Integer to words coding challenge
UNIT_WORD = [
'zero',
'one',
'two',
'three',
'four',
'five',
'six',
'seven',
'eight',
@tremby
tremby / findstrings.py
Last active January 8, 2019 21:23
Find and highlight strings in python code, helpful for finding things for internationalization.
"""
Usage: python findstrings.py <file.py> [<file.py> [...]]
"""
import tokenize
import token
def findstrings(readline):
for tok in tokenize.tokenize(readline):
if token.tok_name[tok.type] == "STRING":
@tremby
tremby / signpdf.py
Last active October 26, 2018 23:54
Wrapper for pdftk which stamps particular pages with patch PDFs; see --help
#!/usr/bin/env python3
import argparse
import os
import shutil
import string
import subprocess
import tempfile
# Ensure required executables exist
@tremby
tremby / duplicates.py
Created September 6, 2018 23:26
Calculate the expected number of duplicates when choosing n items from a pool of m, p times
import random
from collections import Counter
from itertools import chain
POOL_SIZE = 100
PAGE_SIZE = 9
NUM_PAGES = 2
ITERATIONS = 10000
@tremby
tremby / query.sql
Created May 15, 2018 23:23
Find duplicate episodes in Kodi database
select
tvshow.c00 show,
episode.c12 s,
episode.c13 e,
episode.c00 title,
count(*) num,
group_concat(path.strPath || files.strFilename) locations
from files
join episode on episode.idFile = files.idFile
join path on files.idPath = path.idPath