Skip to content

Instantly share code, notes, and snippets.

View davechristian's full-sized avatar

David Christian davechristian

View GitHub Profile
@davechristian
davechristian / tree_random.py
Created November 27, 2021 17:31
PiHut 3D RGB Xmas Tree Flashing Sequence
# A little program for the PiHut 3D RGB Xmas Tree by Dave Christian
# Assumes tree library code has been setup (see https://github.com/ThePiHut/rgbxmastree#getting-started)
# Provide colours from colorzero library as parameters ie "python tree_random.py red green"
from tree import RGBXmasTree
from colorzero import Color
import random
import sys
tree = RGBXmasTree()
@davechristian
davechristian / pirahna.py
Last active August 29, 2015 13:57
A little script that deletes all unwanted files from a specified path. Note that in it's current form it recursively enters all sub-directories. Example usage: 'python pirahna.py -p /home/bob/Music -x .db,.ini'
#! /usr/bin/env python
# Source is released under the MIT License
# See 'http://opensource.org/licenses/MIT' for more info
# Please be careful with this script! I take no responsibility
# for the accidental deletion of files resulting from use of it :)
import os
import sys
@davechristian
davechristian / Mandelbrot.py
Last active February 3, 2023 15:57
Renders a pretty Mandelbrot set using Python. Created for PiCymru. Note that this script requires NumPy and PIL (Python Imaging Library). Tested using Python 3 on Raspbian OS, and Windows 10/11 (Anaconda).
# Python Mandelbrot set for PiCymru
# This version uses the Python Imaging Library AND NumPy
from PIL import Image
import numpy
WIDTH = 512
HEIGHT = 512
MAX_ITER = 25 # How many iterations to perform z=z2+c
@davechristian
davechristian / GLSLHacker_Mandelbrot.xml
Last active August 29, 2015 13:57
This is a Mandelbrot shader, designed for the Raspberry Pi version of GLSL Hacker (though it will run on any GLSL Hacker version). Grab GLSL Hacker from: http://www.geeks3d.com/20131031/glsl-hacker-0-6-0-0-physx-3-mac-os-x-10-9-autdesk-fbx-raspberry-pi-programming
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<glsl_hacker>
<window name="win3d01" title="Mandelbrot Demo for PiCymru (OpenGL ES 2.0)"
width="1920" height="1080"
gl_version_major="2" gl_version_minor="2"
build_opengl_extensions_list="0" />
@davechristian
davechristian / UrbanDictWOTD.py
Last active January 2, 2016 12:48
Script to download and display the Urban Dictionary word of the day. Used Feedparser to process the RSS feed - see https://code.google.com/p/feedparser for source).
# Simple script to get the Urban Dictionary Word of the Day via RSS
# Code is released under MIT license. Please see http://opensource.org/licenses/MIT for full license
import feedparser # 3rd party: https://code.google.com/p/feedparser/
from HTMLParser import HTMLParser # Python stdlib
import os
class HTMLStripper(HTMLParser, object):
def __init__(self):
HTMLParser.__init__(self)
self.html = ''