Skip to content

Instantly share code, notes, and snippets.

View ssokolow's full-sized avatar

Stephan Sokolow ssokolow

View GitHub Profile
@ssokolow
ssokolow / coloring_helper.py
Last active May 20, 2019 08:39
GIMP Plugin for automating the boilerplate involved in colorizing manga pages my way
#!/usr/bin/python
"""Simple GIMP helper to automate the boierplate of my approach to colorizing
manga pages.
Usage:
1. Run this plugin from "Image > Start Colorizing..."
2. Select the regions to be colored using whatever approach you find works
best. This script will preserve the original image as the bottom layer
(hidden below a solid white layer) so it can easily be used as input for
selection methods which don't play nicely with transparency.
@ssokolow
ssokolow / hp_mocking_names.md
Last active January 8, 2022 17:45
Examples of Name-Based Mockery in Harry Potter Fanfics

Examples of Name-Based Mockery in Harry Potter Fanfics

CONTRIBUTING:

  • Un-cited examples are grandfathered in and new ones are only accepted from people I trust.
  • Contributions of citation links for existing entries or new entries with citation links are welcome from anyone (but I can't guarantee GitHub will send me a notification, so it may take time for me to notice and respond)
  • Ideally, I'd like to cite the sources where I saw the grandfathered-in entries so I may keep them in the TODO list if a citation is given that points to a story I haven't read.
  • Note that, when the chapter numbers given by the author and the site disagree, the author's numbering scheme is used in the titles for citations.

Voldemort:

@ssokolow
ssokolow / generate_sql_docs.py
Created March 4, 2019 02:12
A one-off script for converting a specific dump of the SDL wiki into a Dash/Zeal docset... in case it's useful to someone
#!/usr/bin/env python
"""Quick script to generate a Dash/Zeal docset from the SDL 2 wiki.
Requirements:
- Python 2.x (3.x may work, but it's untested)
- LXML (for parsing the non-XML HTML used in the pages)
- Pillow (for converting favicon.ico into icon.png)
- http://www.libsdl.org/tmp/SDL-wiki.zip
"""
@ssokolow
ssokolow / timestamp.rs
Last active July 23, 2018 09:05
Quick semi-hack to provide a means to serde-serialize file modification times prior to UNIX_EPOCH
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use std::panic::catch_unwind;
/// Variation on `std::time::Duration` that sacrifices a bit of precision on the positive
/// side of the in order to provide a nicely serializable form for `SystemTime` values.
///
/// (Workaround for https://github.com/serde-rs/json/issues/464)
#[derive(Eq, PartialEq, Debug, Serialize, Deserialize)]
pub struct Timestamp {
@ssokolow
ssokolow / spelltextedit.py
Last active November 4, 2023 14:25
Spell-checked QPlainTextEdit for PyQt 5.x using PyEnchant
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""QPlainTextEdit With Inline Spell Check
Original PyQt4 Version:
https://nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check/
Copyright 2009 John Schember
Copyright 2018 Stephan Sokolow
@ssokolow
ssokolow / pycalendar.py
Last active February 8, 2024 21:00
Refactored version of Bill Mill's printable calendar code
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Generate a printable calendar in PDF format, suitable for embedding
into another document.
Tested with Python 2.7.
Dependencies:
- Python
- Reportlab
@ssokolow
ssokolow / 99-rfid-scanner.rules
Created November 2, 2017 14:48
Demonstration of using a cheap chinese RFID reader from a background application without messing up foreground ones
# Use `udevadm info -a -n /dev/input/whatever` to look up ATTRS{name}
SUBSYSTEM=="input", ATTRS{name}=="HID 04d9:1400", MODE="0666"
@ssokolow
ssokolow / screenshot.png
Last active April 22, 2020 13:47
Simple script to streamline the process of updating a Retrode's firmware on Linux
screenshot.png
@ssokolow
ssokolow / Cargo.toml
Last active April 14, 2021 21:43
Simple example of getting the rust-cpython and setuptools-rust examples working together
[package]
name = "unimportant_if_subsumed_by_setuptools"
version = "0.1.0"
authors = ["Your Name Here <your@email.com>"]
[lib]
name = "unimportant_if_subsumed_by_setuptools"
crate-type = ["cdylib"]
[dependencies.cpython]
@ssokolow
ssokolow / update_check.py
Last active January 8, 2022 17:45
Simple apt-get update notifier using desktop notifications and cron
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Simple notify2-based apt-get update notifier
Requires:
- dbus-python (A.K.A. python-dbus)
- notify2
- python-gobject (for Python 2.x)
(Though it shouldn't be too difficult to adapt to Python 3.x since