Skip to content

Instantly share code, notes, and snippets.

View fritschy's full-sized avatar

Marcus Borkenhagen fritschy

  • Black Forest, Germany
View GitHub Profile
@fritschy
fritschy / flatpak-fuse.py
Last active April 13, 2025 21:40
Fuse filesystem that exposes runners for all installed flatpak applications
#!/usr/bin/env python3
import os, errno, stat, sys
import copy
import fuse
from subprocess import run, PIPE
from time import time
fuse.fuse_python_api = (0, 2)
@fritschy
fritschy / download.sh
Created March 28, 2024 12:28
Download Cixin Liu: Trisolaris-Trilogie - Sci-Fi Hörspiel-Serie | WDR
wget -ct0 -O1_die-drei-sonnen-1-12-rotes-ufer_3094375_56747683.mp3 https://wdrmedien-a.akamaihd.net/medp/ondemand/weltweit/fsk0/309/3094375/3094375_56747683.mp3
wget -ct0 -O1_die-drei-sonnen-2-12-geheime-forschung_3094376_56747802.mp3 https://wdrmedien-a.akamaihd.net/medp/ondemand/weltweit/fsk0/309/3094376/3094376_56747802.mp3
wget -ct0 -O1_die-drei-sonnen-3-12-das-verhoer_3094381_56747875.mp3 https://wdrmedien-a.akamaihd.net/medp/ondemand/weltweit/fsk0/309/3094381/3094381_56747875.mp3
wget -ct0 -O1_die-drei-sonnen-4-12-ein-countdown_3094415_56748078.mp3 https://wdrmedien-a.akamaihd.net/medp/ondemand/weltweit/fsk0/309/3094415/3094415_56748078.mp3
wget -ct0 -O1_die-drei-sonnen-5-12-trisolaris_3094418_56748116.mp3 https://wdrmedien-a.akamaihd.net/medp/ondemand/weltweit/fsk0/309/3094418/3094418_56748116.mp3
wget -ct0 -O1_die-drei-sonnen-6-12-seltsame-ereignisse_3094423_56748315.mp3 https://wdrmedien-a.akamaihd.net/medp/ondemand/weltweit/fsk0/309/3094423/3094423_56748315.mp3
wget -ct0 -O1_die-drei-sonnen-7-12-das
@fritschy
fritschy / pwned-passwd.py
Created January 27, 2022 16:37
Check if password is pwned
#!/usr/bin/env python3
import hashlib
import sys
import getpass
import urllib.request
import re
class colors:
red='\033[91m'
#![allow(unused_must_use)]
use std::fmt::Display;
use std::ops::{Add, Sub};
use std::str::FromStr;
#[derive(Copy, Clone)]
struct Stdio {}
impl<T: Display> Add<T> for Stdio {
@fritschy
fritschy / mampf.rs
Last active October 24, 2020 09:38
Mampf, a minimal nom-inspired parser combinator implementation.
// An experiment to better understand nom's implementation and ideas
#[derive(Debug)]
pub enum ErrorKind {
ParseError,
EncodingError,
Take,
TakeUntil,
Integer,
Verify,
@fritschy
fritschy / openssl-helper.sh
Created August 25, 2020 06:28
openssl one liners
# generate 2048 bit RSA private key (protected by DES3)
openssl genrsa -des3 -out private.pem 2048
# same generation w/o DES3
openssl genrsa -out private.pem 2048
# convert PEM to DER
openssl rsa -in private.pem -pubout -outform DER > public.der
# generate (self signed) certificate (e.g. for use in webservers)
@fritschy
fritschy / encode-video.zsh
Last active June 1, 2021 13:47
Wrapper around my mostly-used-part of ffmpeg ...
#!/usr/bin/env zsh
set -e
FFMPEG="$HOME/Downloads/ffmpeg-4.2.1-amd64-static/ffmpeg"
CRF=20
VCODEC=libx264
PRESET=
DEBUG=x
FORCE=()
@fritschy
fritschy / cryptsetup-with-luks2-and-integrity-demo.sh
Created April 20, 2020 13:08 — forked from MawKKe/cryptsetup-with-luks2-and-integrity-demo.sh
dm-crypt + dm-integrity + dm-raid = awesome!
#!/usr/bin/env bash
#
# Author: Markus (MawKKe) [email protected]
# Date: 2018-03-19
#
#
# What?
#
# Linux dm-crypt + dm-integrity + dm-raid (RAID1)
#
@fritschy
fritschy / not-so-smallpt-min.rs
Last active July 29, 2025 07:34
Not so smallpt rust port...
use std::{f64::consts::*,io::*,ops::*,*};type B<T>=Vec<T>; type T=f64;#[
derive(Copy,Clone)]struct V(T,T,T);impl Add for V{ type Output=V;fn add(
self,o:V)->V{V(self.0+o.0, self.1+o.1, self.2+o.2)}} impl Sub for V{type
Output=V; fn sub(self,o:V) ->V{V(self.0-o.0,self.1-o.1,self.2-o.2)}}impl
Mul<T>for V{type Output=V;fn mul(self,o:T)->V{V(self.0*o,self.1*o,self.2
*o)}}impl Mul for V{type Output=V;fn mul(self,o:V)->V{V(self.0*o.0,self.
1*o.1,self.2*o.2)}}const fn b(f:T)->V{V(f,f,f)}impl V{fn n(self)->V{self
*(1./self.d(self).sqrt())}fn d(self,o:V)->T{self.0*o.0+self.1*o.1+self.2
*o.2}fn c(self,o:V)->V{V( self.1*o.2- self.2*o.1, self.2*o.0-self.0*o.2,
self.0*o.1-self.1*o.0)}}#[derive(Copy,Clone)]struct R(V,V);enum M{D,S,R}
@fritschy
fritschy / reddit-stuff.js
Last active March 11, 2020 09:29
Unsave/Unlike reddit posts JS snippet
// Paste to firefox js console
// Source: https://stackoverflow.com/a/59443772
// XXX unsave posts
const delay = ms => new Promise(res => setTimeout(res, ms));
(async () => {
for (const a of document.querySelectorAll('.link-unsave-button > a, .comment-unsave-button > a')) {
a.click();
await delay(300);
}