Skip to content

Instantly share code, notes, and snippets.

@thorsummoner
thorsummoner / python-sdl2-opengl.py
Last active Oct 12, 2016 — forked from hurricanerix/python-sdl2-opengl.py
Simple python app setting up SDL2 & OpenGL.
View python-sdl2-opengl.py
#!/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 Mar 3, 2020 — forked from cournape/gist:1077528
cython c++ example
View .gitignore
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
@thorsummoner
thorsummoner / warppointer.py
Last active Oct 10, 2015 — forked from keturn/warppointer.py
xwarppointer python script, updated to be more python, (and pylint passing)
View warppointer.py
#!/usr/bin/env python
"""Make the X cursor wrap-around.
Adapted from http://appdb.winehq.org/objectManager.php?sClass=version&iId=12599
to work around lack of relative mouse movement http://wiki.winehq.org/Bug6971
for Thief: Dark Shadows (and possibly others)
This version is a little kinder to your CPU than the shell script with
the busy-loop that starts a new process for every pointer query.
"""
View imageviewer.py
#!/usr/bin/env python
import argparse
import cairo
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import GObject
View gist:e906529da9b3b26f4a65
from itertools import izip, product, tee
# Logic functions: take and return iterators of truth values
def AND(a, b):
for p, q in izip(a, b):
yield p and q
def OR(a, b):
for p, q in izip(a, b):