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 / 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 / x11_watch_active_window.py
Last active May 13, 2019
python-xlib example which reacts to changing the active window
View x11_watch_active_window.py
#!/usr/bin/env python
"""python-xlib example which reacts to changing the active window/title.
Requires:
- Python
- python-xlib
Tested with Python 2.x because my Kubuntu 14.04 doesn't come with python-xlib
for Python 3.x.
@ssokolow
ssokolow / pagination_example.sql
Created Dec 23, 2009
Reasonably efficient pagination without OFFSET (SQLite version)
View pagination_example.sql
-- Reasonably efficient pagination without OFFSET
-- SQLite version (Adapted from MS SQL syntax)
-- Source: http://www.phpbuilder.com/board/showpost.php?p=10376515&postcount=6
SELECT foo, bar, baz, quux FROM table
WHERE oid NOT IN ( SELECT oid FROM table
ORDER BY title ASC LIMIT 50 )
ORDER BY title ASC LIMIT 10
@ssokolow
ssokolow / png2pdf.py
Created Dec 26, 2011
Simple script for converting a set of PNGs into a PDF
View png2pdf.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A simple tool for converting batches of PNG pages into a PDF file.
Usage:
1. Drop into the folder with the PNGs.
2. chmod +x png2pdf.py
3. Double-click it.
Requires:
@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 / install.sh
Last active Apr 9, 2019
Simple XDG Install Script for Linux Games
View install.sh
#!/bin/sh
#
# Simple XDG Install Script for Linux Games
#
# Features:
# - Communicates with the desktop via the xdg-utils vendor integration scripts.
# (No need to upgrade if the implementation details change.)
# - Icons are resolved via the desktop theming system, granting theme
# developers the ability to provide customized versions which preserve the
# overall system aesthetic.
@ssokolow
ssokolow / boilerplate.py
Last active Mar 31, 2019
Python boilerplate from which I start all my projects
View boilerplate.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""[application description here]"""
__appname__ = "[application name here]"
__author__ = "Stephan Sokolow (deitarion/SSokolow)"
__version__ = "0.0pre0"
__license__ = "GNU GPL 3.0 or later"
import logging
@ssokolow
ssokolow / get_default_gateway_linux.py
Created Jul 2, 2011
Snippet for getting the default gateway on Linux
View get_default_gateway_linux.py
#Snippet for getting the default gateway on Linux
#No dependencies beyond Python stdlib
import socket, struct
def get_default_gateway_linux():
"""Read the default gateway directly from /proc."""
with open("/proc/net/route") as fh:
for line in fh:
fields = line.strip().split()
@ssokolow
ssokolow / pycalendar.py
Last active Mar 25, 2019
Refactored version of Bill Mill's printable calendar code
View pycalendar.py
#!/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 / geeqie-prepare-background.desktop
Last active Mar 11, 2019
set_background.py: A script to hack desktop-spanning background support into KDE 4.x
View geeqie-prepare-background.desktop
[Desktop Entry]
# IMPORTANT: THIS FILE IS A ONE-OFF HACK THAT I WROTE FOR MYSELF AND I AM
# SHARING IT AS AN EXAMPLE. I DO NOT GUARANTEE THAT IT WILL WORK AS-IS ON
# YOUR DESKTOP.
#
# Requirements:
# - Geeqie
# - Zenity
# - ~/bin/set_background.py
#
You can’t perform that action at this time.