Skip to content

Instantly share code, notes, and snippets.

@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 / logging.py
Last active September 29, 2016 17:14
logging snippet
#!/usr/bin/env python3
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('urllib3').setLevel(logging.WARNING)
LOGGER = logging.getLogger(os.path.basename(__file__))
@thorsummoner
thorsummoner / steamscript
Last active September 18, 2016 07:18
steamscript
#!/bin/bash
# steamcmd doesn't handle the shebang line, so lets remove it :\ Woo
# Use Tail to strip first line (print all lines starting at 2) of our input file
# Call steamcmd with automatic login and automatic exit
steamcmd +login ${STEAMLOGIN:-thorsummoner0} +runscript <(tail -n+2 $1) +exit
@thorsummoner
thorsummoner / gist:61d08448f48ebe017f5cf7718ff667e8
Last active August 25, 2016 05:34
apt-fast with squid-dep-proxy over zeroconf/avahi/bonjore
# Given your quid-deb-proxy is using the hostname `apt` and has avahi-daemon installed
# Change /etc/apt-fast.conf to include `--async-dns=false --http-proxy=apt.local`
_DOWNLOADER='aria2c -c -j ${_MAXNUM} --async-dns=false --http-proxy=apt.local -i ${DLLIST} --connect-timeout=600 --timeout=600 -m0'
# Using aysnc-dns will hit this line in aria2c:
# https://github.com/aria2/aria2/blob/a1ce6d2e7f8824b1c1cd18d4e531d84ba58a07df/src/AbstractCommand.cc#L788
# Due to this behavor getting set:
# https://github.com/aria2/aria2/blob/a1ce6d2e7f8824b1c1cd18d4e531d84ba58a07df/src/AbstractCommand.cc#L788
#
@thorsummoner
thorsummoner / hell_debuger.py
Created August 13, 2016 05:51
hell debugger
import inspect
depth = 0
def props(obj):
global depth
depth += 1
pr = {}
for name in dir(obj):
try:
value = getattr(obj, name)
{'ERROR': 128,
'FAST_FORWARD': 64,
'FORCED_UPDATE': 32,
'HEAD_UPTODATE': 4,
'NEW_HEAD': 2,
'NEW_TAG': 1,
'REJECTED': 16,
'TAG_UPDATE': 8,
'_flag_map': {' ': 64, '!': 128, '*': 0, '+': 32, '-': 8, '=': 4},
'flags': 4,
@thorsummoner
thorsummoner / numix.slack-theme
Created August 4, 2016 20:56
Numix based Slack theme.
#2d2d2d,#3E313C,#666666,#FFFFFF,#3E313C,#FFFFFF,#d64937,#D64937
@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 / noise_png.py
Created June 17, 2016 16:50
Generates noisy png's with python's random functions.
import sys
import png
import random
import itertools
def rand(entries):
for _ in range(entries):
val = random.choice([0, 255])
assert val != 2
@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.