Skip to content

Instantly share code, notes, and snippets.


Stefan stefanschmidt

  • Berlin, Germany
View GitHub Profile
stefanschmidt /
Created Apr 23, 2022
Delete Firefox Addon preferences
import sys
import glob
import os
import configparser
import json
import sqlite3
# Functions for finding Firefox default profile folder adapted from
stefanschmidt /
Created Apr 22, 2022
Clean Python build directory
import os
import glob
import shutil
from io import open
from setuptools import Command, setup
# Slightly modified and extended version of this approach:
stefanschmidt /
Created Apr 14, 2022
Download file in headless Firefox with Selenium and geckodriver on macOS
# install requirements
# brew install python@3.10 # Python 3.7+ required
# brew install geckodriver # To access Firefox
# pip install --upgrade selenium
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
stefanschmidt /
Last active Mar 31, 2022
Install latest built distribution of OpenCV python bindings on macOS Mojave with Homebrew and pip
brew install python@3.9
pip3.9 install opencv-python==
stefanschmidt / chkrootkit-mojave-timed.log
Created Mar 29, 2022
chkrootkit 0.55 reports false positive for timed on macOS Mojave 10.14.6 (18G103)
View chkrootkit-mojave-timed.log
$ sw_vers | grep -E 'ProductVersion|BuildVersion'
ProductVersion: 10.14.6
BuildVersion: 18G103
$ brew install chkrootkit
==> Downloading
Already downloaded: /Users/stefan/Library/Caches/Homebrew/downloads/09b127ebda92fbe220c997e4b03716223b647c1893d08c2f8f35ccac65b71a0a--chkrootkit-0.55.bottle_manifest.json
==> Downloading
Already downloaded: /Users/stefan/Library/Caches/Homebrew/downloads/a1e9dccaef720633989239dbd3fcb79d4fc7252965ed73e7eb4a2ffe2795a0b4--chkrootkit--0.55.mojave.bottle.tar.gz
==> Pouring chkrootkit--0.55.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/chkrootkit/0.55: 15 files, 170.8KB
stefanschmidt /
Created Mar 26, 2022
OCR an image file with german language with tesseract on macOS
brew install tesseract
brew install tesseract-lang
tesseract -l deu input.png output.txt
stefanschmidt /
Created Mar 13, 2022
Simple command line interface for
#!/usr/bin/env python
import sys
import requests as req
from bs4 import BeautifulSoup
if not(len(sys.argv) == 2):
sys.exit("Usage: extension")
ext = str(sys.argv[1])
stefanschmidt / batch-re-crawl-pinboard-bookmarks.js
Last active Mar 9, 2022
Batch re-crawl all Pinboard bookmarks that show an error 500 instead of a link to an archived copy
View batch-re-crawl-pinboard-bookmarks.js
1. Open in browser
2. Maximize the number of displayed bookmarks per page (160)
3. Open the JavaScript Console in browser
4. Paste the below snippet to re-crawl all links with error 500
5. Refresh browser and repeat as needed
const list = document.querySelectorAll('a[title="Click to re-crawl this link"]');
const regexp = /mark_for_recrawl\(this, (\d+), '([0-9a-f]+)'\);return false;/g;
stefanschmidt / charles-proxy-rewrite-reponse.xml
Last active Mar 5, 2022
Charles Proxy rewrite rule to remove object-src 'none'; from HTTPS response headers for PDF files from to enable display in Safari avoiding "Blocked Plugin-In" error
View charles-proxy-rewrite-reponse.xml
<?xml version='1.0' encoding='UTF-8' ?>
<?charles serialisation-version='2.0' ?>