Skip to content

Instantly share code, notes, and snippets.

@ruedesign
ruedesign / thread.py
Last active July 29, 2023 22:12
Python thread sample with handling Ctrl-C
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, time, threading, abc
from optparse import OptionParser
def parse_options():
parser = OptionParser()
parser.add_option("-t", action="store", type="int", dest="threadNum", default=1,
help="thread count [1]")
@spiwn
spiwn / README.txt
Created February 21, 2012 13:50
A simple python utility to change a process' priority
A very simple script to change a process' priority in native python 3.#
Works on Windows only (for now)
Todo:
Make it less hacky, more portable (should extract values from the api and use them instead of the hardcoded ones)
Add documentation
@jasonbot
jasonbot / textmetrics.py
Created January 31, 2012 21:50
Get the width and height (in inches) of a string using the Win32 CTypes APIs.
import ctypes
import ctypes.wintypes
class Constants(object):
"Container for constants found in win32 headers"
WS_OVERLAPPED = 0x00000000L
WS_POPUP = 0x80000000L
WS_CHILD = 0x40000000L
WS_MINIMIZE = 0x20000000L
WS_VISIBLE = 0x10000000L