Skip to content

Instantly share code, notes, and snippets.

@hhsprings
hhsprings / windows_themepack_builder.py
Last active October 12, 2021 23:34
A Simple Windows Themepack Builder
# -*- coding: utf-8 -*-
# only for windows (7+)
# require: python 3.x, pillow
"""
This script file is assumed to be managed by three aliases:
* windows_themepack_builder.py
* windows_soundscheme_pcglobal.py
* windows_cursorscheme_pcglobal.py
Hard link should be done:
$ ln windows_themepack_builder.py windows_soundscheme_pcglobal.py
@hhsprings
hhsprings / mpplgen.py
Last active March 13, 2022 12:26
minimal playlist generator (for Windows Media Player, MPC-HC, etc)
#! py -3
# -*- coding: utf-8 -*-
# required: python3, mako, dateutil
r"""
easiest usage:
$ python3 mpplgen.py out.m3u8 --from_askopenfilenames --postproc_simple_editor
from pattern:
$ python3 mpplgen.py out.m3u8 --from_pattern='[1-3]*.wav'
@hhsprings
hhsprings / chrometabopen.py
Last active May 3, 2021 05:23
more simple version chrome opener than "Tools/script/google.py" (It's just a sample script.)
# -*- coding: utf-8 -*-
import io
import sys
import os
import re
import json
import ctypes
__MYNAME__, _ = os.path.splitext(
@hhsprings
hhsprings / obs_compressedfilesize.py
Last active April 26, 2021 11:15
An example for ctypes.windll.kernel32.GetCompressedFileSizeW, ctypes.windll.kernel32.GetDiskFreeSpaceExW and curses
#! py -3
# -*- coding: utf-8 -*-
import sys
import os
import time
import ctypes
import functools
from glob import glob
from fnmatch import fnmatch
from datetime import datetime
@hhsprings
hhsprings / okcancel_or_timeout_dialog.py
Last active March 18, 2022 09:06
Something like a kitchen timer (intended for a tkinter demo)
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import re
import time
import operator
import functools
@hhsprings
hhsprings / pscmdlines.py
Last active April 9, 2022 23:57
A simple example of Python's "psutil" package (with features such as kill, pause, resume)
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
import os
import sys
import pipes
import re
import psutil # pip install psutil
@hhsprings
hhsprings / dfviz_as_curses_example.py
Last active April 3, 2021 02:30
example for "psutil", and "curses"
# -*- coding: utf-8 -*-
import sys
import time
from datetime import datetime
import curses
import psutil
class _Main(object):
def __init__(self):
@hhsprings
hhsprings / urls2htmlcal.py
Last active September 6, 2021 09:28
url list to html calendar
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
import io
import sys
import re
import os
import datetime
from collections import namedtuple
@hhsprings
hhsprings / digitalclock_as_curses_example.py
Last active April 11, 2021 14:14
世界一おバカな curses サンプル。デジタル時計。要: pillow(, windows-curses)
# -*- coding: utf-8 -*-
import sys
import time
from datetime import datetime, timedelta
from PIL import Image, ImageDraw, ImageFont
import curses
class _Main(object):
def __init__(self, fontname, fontsize, beep_after):
@hhsprings
hhsprings / globffprobe.py
Created March 26, 2021 13:37
nearly equals to "for i in * ; do ffpprobe -hide_banner $i ; done" with a few extra values
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import subprocess
if hasattr("", "decode"):
_encode = lambda s: s.encode(sys.getfilesystemencoding())
else: