Skip to content

Instantly share code, notes, and snippets.

@mikitsu
mikitsu / simple_gemini_client.py
Created February 16, 2021 13:21
Simple terminal gemini client (no client certs, bookmarks, permanent redirects, but links, input via 1x code and TOFU) in 100 lines of Python
#!/usr/bin/env python3
import ssl
import sys
import cgi
import socket
import hashlib
import urllib.parse
import json
MAX_RECV_CHUNKS = 10 * 1024 # == 10 MiB
@mikitsu
mikitsu / make-dvd.md
Last active May 29, 2024 23:22
How to create a Video DVD with menus using dvdauthor and ffmpeg

Make DVD Videos with dvdauthor and FFmpeg

Preparation

Prepare the videos by converting them with ffmpeg

ffmpeg -i 'some input file.mp4' -target [pal-dvd or ntsc-dvd] output.mpg
@mikitsu
mikitsu / FirejailFS.md
Created November 7, 2020 17:23
Simple Python FUSE filesystem for firejail sandboxes

FirejailFS

Requirements: Python, fusepy and firejail.

Usage: FirejailFS.py sandboxname /path/to/mountpoint

The filesystem supports everything available via firejail's own --get, --put and --ls options. The main intended usage is to be able to use your shell's path completition

#!/usr/bin/env python3
"""Etherpad Lite client. Modified from https://github.com/Changaco/python-etherpad_lite"""
import requests
import functools
import json
if __name__ == '__main__':
import argparse
import getpass
@mikitsu
mikitsu / !upload.php
Last active March 1, 2020 18:33
Simple PHP uploader
<?php
// the location of the configuration/state data in JSON format
$CONFIG_FILE = '/path/to/config.json';
/* Config file format:
* The configuration file is a JSON object with the following (sub-keys):
* - 'users': an object mapping user names to objects with the following keys:
* - 'password': the user's password, in the format accepted by password_verify
* - 'upload interval': the time limit between successive uploads by the user, in seconds
* - 'upload directory': the directory to place the user's uploads in; this should end in the path separator.
* - 'max file size': the maximum uploadable file size, in bytes