Skip to content

Instantly share code, notes, and snippets.

View tbnorth's full-sized avatar

Terry Brown tbnorth

View GitHub Profile
@tbnorth
tbnorth / pyqt58style.py
Last active March 16, 2017 13:04
Demo Qt 5.8 stylesheet tilde problem
"""
Qt >= 5.8 stops parsing stylesheet when it sees ~=,
button text is underlined but not italic, and doesn't change when clicked
PyQt < 5.8 works as expected, button text is underlined and italic,
and becomes large and red when clicked
"""
import sys
from PyQt5 import QtWidgets
@tbnorth
tbnorth / launcher.py
Last active January 30, 2017 15:25
Python script to scan task list and launch missing background tasks
"""
launcher.py - scan running tasks and launch as needed. Useful on Windows where
cygwin's ps isn't informative and procps may be unavailable.
Terry N. Brown, [email protected], Mon Jan 30 09:20:30 2017
"""
import sys
from subprocess import Popen, PIPE
@tbnorth
tbnorth / makecsvt.py
Created January 26, 2017 19:39
Make a GDAL csvt file for a csv file
"""
makecsvt.py - make GDAL .csvt file
Terry Brown, [email protected], Thu Aug 04 10:04:14 2016
"""
import csv
import sys
def get_type_text(path):
# insert / update headlines as comments in @nosent R code
headlines = []
for nd in p.self_and_subtree_iter():
if nd.h and nd.h[0] == '@' or nd.b and nd.b[0] == '@':
continue
headlines.append(nd.h)
lines = nd.b.split('\n')
@tbnorth
tbnorth / blacktape.py
Last active August 8, 2020 11:45
A PyQt "task launcher" for quick access to python scripts.
"""
A PyQt piece of black tape to cover annoying screen features.
[email protected], 2019-10-03
"""
import sys
try:
from PyQt5 import QtWidgets, QtCore, Qt
from PyQt5.QtCore import Qt as QtConst
@tbnorth
tbnorth / pywait.py
Last active March 3, 2023 15:13
pywait.py - execute arguments whenever a file changes
"""
pywait.py - execute arguments whenever a file changes
Terry N. Brown, [email protected], Mon Dec 12 10:47:49 2016
"""
import os
import sys
import time
@tbnorth
tbnorth / mmove.py
Created October 14, 2016 16:40
Python mouse mover for screen saver suppression
"""
Using mouse events rather than just moving the cursor is important
"""
import sys
import time
import win32api
import win32con
last = -1
@tbnorth
tbnorth / place_window.py
Created September 21, 2016 17:24
Window placement in Windows with Python
"""
Wait 2 seconds then move the active window to the top/bottom
of the left monitor
[email protected], 2016-09-21
"""
import sys
import win32gui
import win32con
@tbnorth
tbnorth / report_reminder.py
Last active March 15, 2023 21:08
Open a big red window when a window called r".*Reminder.*" exists. Because Outlook reminder windows get buried and fail to remind.
"""
Open a big red window when a window called r".*Reminder.*" exists.
Because Outlook reminder windows get buried and fail to remind.
Thanks to http://stackoverflow.com/q/18146596/1072212
[email protected], 2016-09-19
"""
@tbnorth
tbnorth / bootreveal.sh
Last active August 15, 2019 17:24
Bash script to start a new reveal.js presentation on GitHub pages
GITUSER="$1"
NAME="$2"
if [ -e "$NAME" ]; then
echo "$NAME exists, quitting"
return 10 2> /dev/null || exit 10
fi
git clone --depth 1 https://github.com/hakimel/reveal.js "$NAME"
if ! cd "$NAME"; then