Skip to content

Instantly share code, notes, and snippets.

@will-hart
will-hart / arduino_charlieplex.c
Created July 13, 2012 18:25
Charlieplex_LEDs_Arduino
/**************************************/
/* Charlieplexing 6 LEDs with 3 Pins */
/* */
/* Code written by William Hart, 2011 */
/* http://www.williamhart.info */
/* */
/* Uses 3 pins to power a network of */
/* 6 LEDs using the charlieplexing */
/* technique. */
/**************************************/
// a basic counter and date template for adding new data
var seconds = 0;
var base_date = "2012-10-09 12:57:";
// declare five data arrays
var all_data = [
[],
[],
[],
[],
@will-hart
will-hart / plugin.py
Created July 1, 2013 09:36
A simple python plugin system using a custom metaclass
# a simple Python plugin loading system
# see http://stackoverflow.com/questions/14510286/plugin-architecture-plugin-manager-vs-inspecting-from-plugins-import
class PluginMount(type):
"""
A plugin mount point derived from:
http://martyalchin.com/2008/jan/10/simple-plugin-framework/
Acts as a metaclass which creates anything inheriting from Plugin
"""
@will-hart
will-hart / README.md
Last active January 28, 2016 03:15
An ember dice rolling application based on a tutorial at http://www.williamhart.info/an-emberjs-beginners-tutorial.html.
@will-hart
will-hart / build.py
Last active January 26, 2023 12:35
Super Simple Static Site Generator (Python)
"""
Free to use under the MIT license
Builds a static site from a list of Markdown source files. The source
files should have the same directory structure as the desired output.
Files are rendered using Markdown2 and can declare metadata variables:
---
@will-hart
will-hart / README.md
Last active March 22, 2024 04:55
Stitch together tilemaps into a single image

Why?

This is a simple Python / PIL utility for taking a series of images in a tile map set and stitching them together into a single image. This is being used to convert these http://forums.bistudio.com/showthread.php?178671-Tiled-maps-Google-maps-compatible-(WIP) for www.anvilproject.com.

How?

  1. Drop the stitcher.py file into the root directory of your tile map set, where all the numbered folders are
  2. Edit two lines in the file, these are commented - one for the number of folders and one for the number of images in each folder
@will-hart
will-hart / events.cs
Last active September 7, 2016 11:32
Event driven version
///
/// PlayerManager.cs
///
using System;
public class PlayerManager : MonoBehaviour {
public event EventHandler PlayerDied;
@will-hart
will-hart / AbstractComponent.cs
Last active June 8, 2018 21:03
Sentry ECS - a simple public domain entity component system
public abstract class AbstractComponent : IComponent
{
[NonSerialized]
protected Entity _owner;
public AbstractComponent(Entity owner)
{
_owner = owner;
ID = Guid.NewGuid().ToString("n");
}
@will-hart
will-hart / castle.scad
Last active February 5, 2017 08:19
A simple castle wall written in OpenSCAD
// scale the wall up
wall_scale = 10;
// set wall proportions
wall_length = 1;
wall_thickness = 0.3;
wall_height = 0.8;
// crennelation properties
cren_duty_cycle = 0.5;
@will-hart
will-hart / SinglePlayerFallback.cs
Created April 13, 2017 08:01
Single Player Fallback (Forge Networking)
namespace Goliath.Networking
{
#region Dependencies
using BeardedManStudios.Forge.Networking;
using BeardedManStudios.Forge.Networking.Unity;
// other usings
using UnityEngine;
#endregion