Skip to content

Instantly share code, notes, and snippets.

Stephan Sokolow ssokolow

Block or report user

Report or block ssokolow

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ssokolow
ssokolow / python_boilerplate.py
Created Oct 13, 2019
The raw/initial output from "boiler" in my ~/.vim/snippets/python.snippets
View python_boilerplate.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""[application description here]"""
# 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)"
__appname__ = "[application name here]"
@ssokolow
ssokolow / mass_diff.py
Created Oct 4, 2019
Quick helper script to cross-compare large numbers of dumps of a ROM or disk to identify bits that vary between dumps
View mass_diff.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Simple tool to identify bad bits in a cartridge by comparing many dumps
--snip--
Requires numpy.
"""
@ssokolow
ssokolow / gist:5b59998d2245325758ac9bbf462605c2
Created Aug 25, 2019
Helper script to override Firefox's attempt to open .cbz files as Zip files, regardless of OS file associations
View gist:5b59998d2245325758ac9bbf462605c2
#!/bin/sh
# NOTE: Despite this script using KDE commands like ark and kdialog, Firefox
# doesn't obey KDE's file associations, so you'll need to use a non-KDE
# file manager like PCManFM to edit the file associations.
open_zip() {
exec ark "$@"
}
offer_comix() {
@ssokolow
ssokolow / dump_cart.py
Last active Aug 30, 2019
Rough prototype frontend for dumping cartridges with an INL Retro with minimal hassle
View dump_cart.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Streamlined Wizard for dumping games with the INL Retro cartridge dumper"""
__author__ = "Stephan Sokolow (deitarion/SSokolow)"
__appname__ = "INL Retro Dumping Helper"
__version__ = "0.1"
__license__ = "MIT"
# pylint: disable=bad-builtin
@ssokolow
ssokolow / image_widget.py
Last active Nov 22, 2019
PyQt 5.x code for Just Do What I Mean™ image display in the presence of animated GIFs and containers with no fixed aspect ratio
View image_widget.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Example code for a PyQt image-display widget which Just Works™
TODO: Split this into a loader wrapper and a widget wrapper so it can be used
in designs which maintain a preloaded queue of upcoming images to improve
the perception of quick load times.
"""
from __future__ import (absolute_import, division, print_function,
@ssokolow
ssokolow / coloring_helper.py
Last active May 20, 2019
GIMP Plugin for automating the boilerplate involved in colorizing manga pages my way
View coloring_helper.py
#!/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 May 1, 2019
Examples of Name-Based Mockery in Harry Potter Fanfics
View hp_mocking_names.md

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 Mar 4, 2019
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
View generate_sql_docs.py
#!/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 Jul 23, 2018
Quick semi-hack to provide a means to serde-serialize file modification times prior to UNIX_EPOCH
View timestamp.rs
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 {
You can’t perform that action at this time.