View prompt_gentoo_setup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# Modified gentoo prompt theme | |
# customized by Stephan Sokolow for git branch and virtualenv display based on: | |
# http://www.jukie.net/~bart/blog/20071219221358 | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/#comment-4166 | |
# https://virtualenvwrapper.readthedocs.io/en/latest/tips.html | |
# | |
# See also: | |
# https://www.topbug.net/blog/2016/10/11/speed-test-check-the-existence-of-a-command-in-bash-and-zsh/ |
View update_flatpak_cli.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
View onelinespelltextedit.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
"""Single-Line QPlainTextEdit With Inline Spell Check mimicking QLineEdit | |
Original PyQt4 Version: | |
https://nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check/ | |
Multi-Line Version: | |
https://gist.github.com/ssokolow/0e69b9bd9ca442163164c8a9756aa15f | |
TODO: |
View term_qt.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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 |
View x11_watch_active_window.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. |
View escape_non_utf8_paths.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2018-2020, Stephan Sokolow | |
This code is released under your choice of the MIT or Apache-2.0 licenses. | |
https://opensource.org/licenses/MIT | |
https://opensource.org/licenses/Apache-2.0 | |
*/ | |
use std::borrow::Cow; | |
use std::ffi::{OsStr, OsString}; |
View godot_game.iss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; IMPORTANT: Follow the instructions at | |
; https://docs.godotengine.org/en/stable/getting_started/workflow/export/changing_application_icon_for_windows.html | |
; and make sure the "Options > Application > Product Version" field is set | |
; in Godot's Export dialog before exporting your EXE file. Otherwise, | |
; Inno Setup will mistake the Godot version for your game's version. | |
; | |
; You can check whether you were successful by examining the .EXE file's | |
; properties dialog on Windows, or by using the `peres -v` command from `pev` | |
; on Linux. | |
; |
View camelcase.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! Routines for parsing camelcase strings | |
//! | |
use std::mem::replace; | |
use unicode_categories::UnicodeCategories; | |
use unicode_segmentation::{GraphemeIndices, UnicodeSegmentation}; | |
// --== Enums ==-- | |
// TODO: Refresh my memory of which other traits I'm advised to derive on this. |
View trackball.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
View pagination_example.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |
NewerOlder