Skip to content

Instantly share code, notes, and snippets.

@thorsummoner
thorsummoner / file-svg-export.py
Last active February 15, 2024 10:43
GIMP Plug-in for Simple SVG Exports
#!/usr/bin/env python
# GIMP Plug-in for Simple SVG Exports
# Copyright (C) 2016 by Dylan Grafmyre <thorsummoner@live.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
@thorsummoner
thorsummoner / python-sdl2-opengl.py
Last active October 12, 2022 10:53 — forked from hurricanerix/python-sdl2-opengl.py
Simple python app setting up SDL2 & OpenGL.
#!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2014 Richard Hawkins
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@thorsummoner
thorsummoner / .gitignore
Last active May 4, 2022 09:49 — forked from cournape/gist:1077528
cython c++ example
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
@thorsummoner
thorsummoner / linux_diskstats.py
Last active April 7, 2022 20:25
munin diskmon plugin ported to python
#!/usr/bin/env python3
# ported from https://github.com/terrorobe/munin-plugins/blob/master/alumni/linux_diskstats
# GNP GPLv2
import glob
import re as regex
class diskmon(object):
"""docstring for diskmon"""
@thorsummoner
thorsummoner / multiprocessing.py
Last active November 17, 2021 18:30
python multiprocessing example
#!/usr/bin/env python3
""" Example multiprocess based python file
"""
import multiprocessing
import argparse
import itertools
ARGP = argparse.ArgumentParser(
@thorsummoner
thorsummoner / dhclient.conf
Last active July 6, 2021 01:33
How to request specific IP in /etc/dhcp/
# Configuration file for /sbin/dhclient, which is included in Debian's
# dhcp3-client package.
#
# This is a sample configuration file for dhclient. See dhclient.conf's
# man page for more information about the syntax of this file
# and a more comprehensive list of the parameters understood by
# dhclient.
#
# Normally, if the DHCP server provides reasonable information and does
# not leave anything out (like the domain name, for example), then
@thorsummoner
thorsummoner / vmstat-prettyblocks-braille
Created December 20, 2018 08:18
a braille character based vmstat display insired by https://www.reddit.com/comments/9ysbx7
#!/usr/bin/env python3
import argparse
import logging
import psutil
import random
import sys
import time
import shutil
import os
@thorsummoner
thorsummoner / pygtk3-acclerator-demo.py
Last active December 18, 2018 01:47
PyGTK3 Accelerator Demo
#!/usr/bin/env python2
import signal
from gi.repository import Gtk
def bind_accelerator(accelerators, widget, accelerator, signal='clicked'):
key, mod = Gtk.accelerator_parse(accelerator)
widget.add_accelerator(signal, accelerators, key, mod, Gtk.AccelFlags.VISIBLE)
python3 <(printf "import pyfiglet, re, sys, pytz, datetime, time\nwhile True:\n\tprint('\\033[1;1H{}'.format(pyfiglet.Figlet(font=sys.argv[1], width=float('inf')).renderText(' '.join(str(pytz.timezone('utc').localize(datetime.datetime(year=2018, month=10, day=31, hour=23, minute=59, second=59)) - pytz.timezone('America/Los_Angeles').localize(datetime.datetime.now()))))))\n\ttime.sleep(0.02)\n") univers
@thorsummoner
thorsummoner / mcad
Created April 22, 2018 22:13
Minecraft Server Advertizements
#!/usr/bin/env python3
import time
import socket
servers = [
["MOTD", 25565],
]
BROADCAST_IP = "255.255.255.255"