Skip to content

Instantly share code, notes, and snippets.

View pydsigner's full-sized avatar

Daniel Foerster pydsigner

View GitHub Profile
@pydsigner
pydsigner / price-of-sleep.txt
Created September 11, 2012 22:16
Price of Sleep
Day changed to 7 September 2012
04:50:27 PM - monsieur_h> I'm gonna buy myself a few hours of sleep
04:50:48 PM - monsieur_h> See ya later pal
04:50:48 PM * pydsigner charges monsieur_h's credit card $500
04:50:53 PM - pydsigner> ;)
04:51:06 PM - monsieur_h> That's a few WEEKS worth ><
04:51:16 PM - pydsigner> No, 1ms
04:51:21 PM - pydsigner> Hehe
04:51:32 PM - monsieur_h> Well, how much coffee do you drink a day?
04:51:59 PM - pydsigner> 0.00000 grams
@pydsigner
pydsigner / demo.html
Created September 29, 2012 20:31
Forum Mockup
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; UTF-8">
<title>The Python Forum :: What's a good tutorial?</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<meta name="keywords" content="python forum" />
</head>
<body>
<header>
@pydsigner
pydsigner / gist:3860963
Created October 9, 2012 19:39
Mask to PixList
from pgpu.iter_utils import flatten
def get_set(mask):
xsize, ysize = mask.get_size()
# return a 1D list of all the mask locations that are set
return flatten((((x, y) for y in range(ysize) if mask.get_at((x, y)))
for x in range(xsize)), 1)
@pydsigner
pydsigner / samba4.spec
Created October 10, 2012 00:13
Samba4 spec for Mandriva
%define pkg_name samba
%define version 4.0.0rc2
%define rel 9.6
#define subrel 1
%define vscanver 0.3.6c-rc2
%define libsmbmajor 0
%define netapimajor 0
%define smbsharemodesmajor 0
%define tallocmajor 2
%define tallocver 2.0.8
@pydsigner
pydsigner / rotating_box.py
Created October 10, 2012 00:55
Rotating a Red Box
import pygame
pygame.init()
# 1000 ms in a second, cycle length of 30 seconds
CYCLE = 1000. * 30
def add_vectors(vec1, vec2):
return vec1[0] + vec2[0], vec1[1] + vec2[1]
@pydsigner
pydsigner / rotating_box_pyglet.py
Created October 10, 2012 02:02
Rotating a Red Box in Pyglet
import pyglet
CYCLE = 30.
def degrees_from_time(t):
"""
Get the degrees to rotate, which is:
percentage_of_cycle_complete = time_elapsed_in_cycle / cycle_length
@pydsigner
pydsigner / challenge.py
Created October 16, 2012 20:18
Challenge Complete
import re
def is_dynamic(frag):
return re.match("<.*>", frag) != None
class Node(object):
def __init__(self, fragment, isDynamic):
self.children = {}
self.parent = None
self.fragment = fragment
@pydsigner
pydsigner / json_demo.py
Created October 23, 2012 01:57
Lame JSON Demo
import json
def as_cool_class(dct):
if '_is_cool_class' in dct:
return CoolClass(dct['spam'], dct['num'])
return dct
class CoolClass(object):
@pydsigner
pydsigner / surface_merging.py
Created October 23, 2012 01:58
Surface Merger
#import timeit
class Surface(object):
"""
The surface class, which contains material information, how many
indices it uses, and its starting offset in the index buffer.
"""
@pydsigner
pydsigner / gist:4141885
Created November 25, 2012 00:04
Charter

Article I. Voting

All votes in this Charter shall have a set period, after which time the votes shall noted, the voting closes, and the result enacted if the quorum (if required) has been obtained.

If a quorum is required for a vote, that fraction of the active Electors must vote, whether for or against.