Skip to content

Instantly share code, notes, and snippets.

View mikeri's full-sized avatar

Michael Ilsaas mikeri

View GitHub Profile
mikeri /
Last active January 5, 2024 23:59
Ranger plugin for storing metadata in extended file attributes
# Ranger plugin for storing metadata in extended file attributes
# Requires Python 3.3
# drop it in ~/.config/ranger/plugins
from ranger.ext.openstruct import DefaultOpenStruct as ostruct
import ranger.core.metadata
import os
def get_metadata(_, filename):
mikeri /
Created May 6, 2022 08:01
CSS image/file embedder (generates data uri)
import base64
import argparse
import subprocess
parser = argparse.ArgumentParser()
args = parser.parse_args()
mime_args = ("mimetype", "-b", args.file)
mime_type =, capture_output=True).stdout.decode().strip()
mikeri /
Last active June 27, 2021 21:38
Mark an area of the screen, convert it to text and put the text in clipboard
sleep .1
scrot --select /tmp/ocr.png
tesseract -c page_separator="" /tmp/ocr.png /tmp/ocr-out
xclip -selection clipboard -i < /tmp/ocr-out.txt
rm /tmp/ocr.png
rm /tmp/ocr-out.txt
mikeri / scc.zsh-theme
Last active May 18, 2020 11:20
SCC zsh theme
RPROMPT='$(git_prompt_info)%F{yellow}%n%{$reset_color%}%F{240}@%F{blue}%m%{$reset_color%}%(?,,%F{red} [%?]%{$reset_color%})'
PROMPT='%F{240}%25<...<%F{cyan}%~%F{yellow}%B>%b%{$reset_color%}%f '
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
mikeri / mutool-pdf.thumbnailer
Created May 11, 2019 12:14
PDF thumbnailer for using mutool. Very fast.
[Thumbnailer Entry]
Exec=mutool draw -w %s -h %s -o %o %i 1
mikeri /
Last active July 4, 2018 20:10
South Park downloader
# South Park download script
# Uses youtube-dl and ffmpeg
# Downloads the whole series
# and joins the multipart
# episodes into single files
for season in `seq 1 22`:
mikeri / imagemagick-pdf.thumbnailer
Created May 28, 2018 10:09
PDF thumbnailer for using ImageMagick (for users without Evince)
[Thumbnailer Entry]
Exec=convert -alpha deactivate %i[0] -thumbnail %s %o
mikeri / ilbm.thumbnailer
Created May 28, 2018 10:07
ILBM/Amiga IFF thumbnailer for
[Thumbnailer Entry]
Exec=convert %i -thumbnail %s %o
mikeri / userContent.css
Last active November 15, 2017 19:53
userContent.css to fix checkmarks and input fields in Firefox running on dark themed Linux
/* ~/.mozilla/firefox/XXXXXX.default/chrome/userContent.css */
input {
border: 2px inset white;
background-color: white;
color: black;
-moz-appearance: none !important;
textarea {
border: 2px inset white;