Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephan Sokolow ssokolow

View GitHub Profile
@ssokolow
ssokolow / README.md
Last active Apr 26, 2022
Files for making Flatpak builds of lgogdownloader
View README.md

A Flatpak release of LGOGDownloader to provide easy access to up-to-date builds with the optional QtWebEngine dependency enabled.

Note that the included patch for the htmlcxx dependency was submitted to upstream, but the project appears to be unmaintained.

@ssokolow
ssokolow / git-extract-paths-with-history
Last active Jan 8, 2022
Wrapper for git-filter-repo to extract paths into a new clone, preserving history across renames
View git-extract-paths-with-history
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Wrapper for git-filter-repo to extract paths into a new clone, following the
rename history to preserve all revisions of whitelisted paths.
WARNING: There appears to be no way to ask git-filter-repo to exclude stuff
that later takes on a name a renamed file gave up, so this will be
insufficient if you move a/b.py to b/b.py and then create a new a/b.py
and only want to preserve the history of b/b.py without keeping the
unrelated a/b.py.
@ssokolow
ssokolow / update_flatpak_cli.sh
Last active Mar 19, 2022
Proof of concept for making Flatpak-installed GUI apps available in the terminal through their normal command names
View update_flatpak_cli.sh
#!/bin/sh
# Flatpak CLI Shortcut Proof of Concept
# Copyright 2021 Stephan Sokolow (deitarion/SSokolow)
#
# License: MIT
#
# Known shortcomings in this quick and dirty PoC:
# * In order to support non-local URL arguments to Flatpak'd browsers, use of
# --file-forwarding assumes all installed programs will accept file:// URLs.
# (A proper solution would parse the .desktop files to identify what kinds of
@ssokolow
ssokolow / strip_emoji.py
Created Mar 17, 2021
Simple script to rename non-BMP Unicode characters out of file and folder names, recursively
View strip_emoji.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Strip emoji and other non-BMP codepoints from paths to make them compatible
with mkisofs/genisoimage"""
# Prevent Python 2.x PyLint from complaining if run on this
from __future__ import (absolute_import, division, print_function,
with_statement, unicode_literals)
__author__ = "Stephan Sokolow (deitarion/SSokolow)"
@ssokolow
ssokolow / trackball.sh
Last active Apr 29, 2021
xinput configuration for an old two-button Logitech Marble Mouse
View trackball.sh
#!/bin/sh
# Setup for comfortable use of an old two-button Logitech Marble Mouse
# via a cheap USB-PS/2 adapter.
#
# Resulting functionality:
# 1. Pointer acceleration is tweaked to be usable on a three-monitor spread
# 2. Press and hold left button for 300ms to get right-click
# 3. Right mouse button is remapped to middle mouse button
# 4. Holding the right button turns the trackball into a scroll wheel
# 5. Both vertical and horizontal scrolling are enabled
@ssokolow
ssokolow / nugar_on_perfect_lionheart.md
Created Sep 21, 2020
A mirror of Nugar's analysis/rant on the author Perfect Lionheart for people who don't want to link to a post in a thread
View nugar_on_perfect_lionheart.md

Nugar said:

Sociopathy and Psychopathy the wikipedia article.

Yes, I know it's wikipedia. I know wikipedia isn't exactly reliable. Still, it's easy and convienient. It also states that there's functionally very little difference between psychopathy and sociopathy. Given the medical definitions and such for each, okay, I'll go along with that.

Now. Lets look at some of this.

They make a superficially good first impression.

@ssokolow
ssokolow / anon.sh
Last active Jan 8, 2022
Zsh command to make an "incognito mode" for a terminal
View anon.sh
# Convenience helper to set up an "incognito mode" for a shell session.
#
# Installation:
# 1. Create a folder like ~/.zsh/functions
# 2. Add it to your ZSH function path with fpath=(~/.zsh/functions(:A) $fpath) in ~/.zshenv
# 3. Save this script as ~/.zsh/functions/anonsh
# 4. Add `autoload -Uz anonsh` to your ~/.zshrc
#
# Now you can type `anonsh` in any zsh session
#
@ssokolow
ssokolow / 1_screenshot.png
Last active Jun 29, 2021
Simple PyQt5 application to inspect drag-and-drop or clipboard data
@ssokolow
ssokolow / term_qt.py
Created Apr 26, 2020
Example of creating a simple terminal emulator widget from a QTextEdit
View term_qt.py
"""Primitive terminal emulator example made from a PyQt QTextEdit widget."""
import fcntl, locale, os, pty, struct, sys, termios
import subprocess # nosec
# Quick hack to limit the scope of the PyLint warning disabler
try:
# pylint: disable=no-name-in-module
from PyQt5.QtCore import Qt, QSocketNotifier # type: ignore
from PyQt5.QtGui import QFont, QPalette, QTextCursor # type: ignore
@ssokolow
ssokolow / ocv.py
Created Apr 24, 2020
OpenCV's :ocv: Sphinx domain, patched up for Sphinx 2.3
View ocv.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
ocv domain, a modified copy of sphinx.domains.cpp + shpinx.domains.python.
The original copyright is below
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The OpenCV C/C++/Python/Java/... language domain.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.