Skip to content

Instantly share code, notes, and snippets.

View stefanschmidt's full-sized avatar

Stefan stefanschmidt

  • Hamburg, Germany
View GitHub Profile
@stefanschmidt
stefanschmidt / chkrootkit-mojave-timed.log
Created March 29, 2022 14:33
chkrootkit 0.55 reports false positive for timed on macOS Mojave 10.14.6 (18G103)
$ sw_vers | grep -E 'ProductVersion|BuildVersion'
ProductVersion: 10.14.6
BuildVersion: 18G103
$ brew install chkrootkit
==> Downloading https://ghcr.io/v2/homebrew/core/chkrootkit/manifests/0.55
Already downloaded: /Users/stefan/Library/Caches/Homebrew/downloads/09b127ebda92fbe220c997e4b03716223b647c1893d08c2f8f35ccac65b71a0a--chkrootkit-0.55.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/chkrootkit/blobs/sha256:dcb47fe
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
stefanschmidt / tesseract-ocr-macos.sh
Created March 26, 2022 16:50
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
stefanschmidt / fileinfo.py
Created March 13, 2022 00:17
Simple command line interface for fileinfo.com
#!/usr/bin/env python
import sys
import requests as req
from bs4 import BeautifulSoup
if not(len(sys.argv) == 2):
sys.exit("Usage: fileinfo.py extension")
ext = str(sys.argv[1])
@stefanschmidt
stefanschmidt / batch-re-crawl-pinboard-bookmarks.js
Last active March 9, 2022 19:12
Batch re-crawl all Pinboard bookmarks that show an error 500 instead of a link to an archived copy
/*
1. Open https://pinboard.in/u:account/code:500 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
stefanschmidt / charles-proxy-rewrite-reponse.xml
Last active March 5, 2022 00:11
Charles Proxy rewrite rule to remove object-src 'none'; from HTTPS response headers for PDF files from afaa.com to enable display in Safari avoiding "Blocked Plugin-In" error
<?xml version='1.0' encoding='UTF-8' ?>
<?charles serialisation-version='2.0' ?>
<rewriteSet-array>
<rewriteSet>
<active>true</active>
<name>AFAA</name>
<hosts>
<locationPatterns>
<locationMatch>
<location>
@stefanschmidt
stefanschmidt / force-download-install-xprotect-config.log
Last active October 3, 2022 11:32
Force immediate download and/or install of XProtect configuration update on macOS
# https://www.jamf.com/blog/high-sierra-installer-reverts-xprotect-rules/
$ softwareupdate -l --include-config-data
Software Update Tool
Finding available software
Software Update found the following new or updated software:
* XProtectPlistConfigData_10_14-2157
XProtectPlistConfigData (2157), 947K [recommended]
@stefanschmidt
stefanschmidt / youtube-dl.rb
Created February 22, 2022 00:39
Homebrew formula for installing youtube-dl from head
class YoutubeDl < Formula
include Language::Python::Virtualenv
desc "Download YouTube videos from the command-line"
homepage "https://youtube-dl.org/"
url "https://files.pythonhosted.org/packages/01/4f/ab0d0806f4d818168d0ec833df14078c9d1ddddb5c42fa7bfb6f15ecbfa7/youtube_dl-2021.12.17.tar.gz"
sha256 "bc59e86c5d15d887ac590454511f08ce2c47698d5a82c27bfe27b5d814bbaed2"
license "Unlicense"
head "https://github.com/ytdl-org/youtube-dl.git"
@stefanschmidt
stefanschmidt / date_parsing_performance.py
Created February 4, 2022 21:35
Compare dynamic and static date parsing in Python
# As a response to a proposal on Stack Overflow to use parser from dateutil to
# parse dates without needing to specify the date format one commenter noted:
# "Be aware that for large data amounts this might not be the most optimal
# way to approach the problem. Guessing the format every single time may
# be horribly slow." - https://stackoverflow.com/questions/466345
#
# I was wondering what "horribly slow" could mean in practice.
#
# In a quick performance comparison I could observe that static parsing
# (datetime.strptime) was on average about 5x faster than dynamic parsing
@stefanschmidt
stefanschmidt / libpff.rb
Created May 21, 2021 23:45
Homebrew formula for libpff
class Libpff < Formula
desc "libpff is a library to access the Personal Folder File (PFF) and the Offline Folder File (OFF) format"
homepage "https://github.com/libyal/libpff"
license "LGPLv3+"
head "https://github.com/libyal/libpff.git", :branch => "main"
# depends_on "cmake" => :build
depends_on "gettext"
depends_on "automake"
depends_on "libtool"
@stefanschmidt
stefanschmidt / install-markdeck.sh
Last active May 16, 2021 09:46
Installing markdeck on macOS Mojave
# MarkDeck: presentations as code
# https://arnehilmann.github.io/markdeck/
# install Docker Desktop (requires root privileges)
brew install --cask docker
# install Docker command line binaries
# /usr/local/bin/docker
# /usr/local/bin/docker-compose
open /Applications/Docker.app