Skip to content

Instantly share code, notes, and snippets.

René Dudfield illume

Block or report user

Report or block illume

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
import pygame
from pygame.locals import *
RES=(160, 120)
clock = pygame.time.Clock()
illume /
Last active Jul 14, 2019
headless pygame (without a window) playing two sounds at different times.
""" headless pygame (without a window) playing two sounds one after the other.
import os, sys, time
import pygame
import pygame.examples
# a pretend video.
os.environ["SDL_VIDEODRIVER"] = "dummy"
illume /
Last active Jun 11, 2019
Tornado run task in a thread pool.
""" Run a task in a background thread.
python3 -m pip install tornado --user
curl http://localhost:8888/2
See `run_on_executor` documentation:
See for another approach:
illume /
Last active Jun 21, 2019
hexagonal circle drawing
#!/usr/bin/env python
import pygame
import math
def draw_aacircle(surface, color, pos, radius, width=0):
r, g, b = color
position_x, position_y = pos
alpha_max = 255
illume /
Last active Nov 14, 2018
A metronome in pygame.
Show a light for every beat.
Show the BPM as text.
Use 4/4 timing. Four beats to a bar.
Press space until the BPM gets to what you want.
import time
import os
import pygame as pg
illume /
Last active Jul 8, 2019
Shows how to use flask and matplotlib together.
""" Shows how to use flask and matplotlib together.
Shows SVG, and png.
The SVG is easier to style with CSS, and hook JS events to in browser.
python3 -m venv venv
. ./venv/bin/activate
pip install flask matplotlib
illume /
Last active Jan 4, 2019
pypy hacky benchmark based on example
#!/usr/bin/env python
# like the testsprite.c that comes with sdl, this pygame version shows
# lots of sprites moving around.
import pygame, sys, os
from pygame.locals import *
from random import randint
from time import time
import gc
import pygame.joystick
View BEXT-wav-files.diff
diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c
index b4ad6c7..2d50486 100644
--- a/src/audio/SDL_wave.c
+++ b/src/audio/SDL_wave.c
@@ -445,7 +445,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
/* 2 Uint32's for chunk header+len, plus the lenread */
headerDiff += lenread + 2 * sizeof(Uint32);
- } while ( (chunk.magic == FACT) || (chunk.magic == LIST) );
+ } while ( (chunk.magic == FACT) || (chunk.magic == LIST) || (chunk.magic == BEXT) );
illume / portmidi.rb
Last active May 17, 2018
portmidi homebrew formular without broken python
View portmidi.rb
class Portmidi < Formula
desc "Cross-platform library for real-time MIDI I/O"
homepage ""
url ""
sha256 "08e9a892bd80bdb1115213fb72dc29a7bf2ff108b378180586aa65f3cfd42e0f"
revision 1
bottle do
cellar :any
sha256 "c8f2755fd775064c282da84d666336d9125c6e70082975ffdc0867dee60b5802" => :high_sierra
illume /
Last active Apr 18, 2018
Shows the invert function.
import os
import pygame as pg
main_dir = os.path.split(os.path.abspath(__file__))[0]
# data_dir = os.path.join(main_dir, 'data')
data_dir = main_dir
def show(image):
screen = pg.display.get_surface()
screen.fill((0, 255, 255))
You can’t perform that action at this time.