Skip to content

Instantly share code, notes, and snippets.

@Todd-Davies
Todd-Davies / progress_wheel.pde
Created August 18, 2012 13:06
Processing progress wheel
//===============================================================================================
//Author: Todd Davies
//Date: 18.08.2012
//Description: I was bored, and needed to make sure I could still remember how to use Processing.
// Download Processing here: http://processing.org/download/
//===============================================================================================
int radius = 120;
int centerX = 250;
int centerY= 250;
int progress = 0;
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<body>
<scene id="scene1">
<label t="translate(0,346)">
<tspan x="0" y="0em">Comix Sample</tspan>
</label>
<actor t="translate(131,49)" pose="-11,9|-5,117|-11,99|-11,89|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-18,79|-18,59|-6,79|-1,59">

Squire

Today, I made a neat little python script to automatically do stuff in my Dropbox based on changes to my Schooltraq account. I decided to call it squire.

What it does

At the moment, it does the following:

@Todd-Davies
Todd-Davies / Executable JSON
Last active September 3, 2023 20:05
I wanted to see what a programming language that was also parsable JSON would look like. This is what I came up with.
"""
I wanted to see what a programming language that was also parsable JSON would look like. This is what I came up with.
Features:
+ Methods (nestable)
+ Variables
+ Built in functions (add, subtract, print etc)
+ Maybe more I've forgotten
Notable omissions as of yet:
# -*- coding: utf-8 -*-
"""
Finds if a word can go through an NFA. Prints the sequence of visited states
if a route can be found.
The example NFA we'll use accepts all words that start and end with 'a':
a
+––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+
| |
| |
@Todd-Davies
Todd-Davies / buffer.c
Last active August 29, 2015 14:07
C character buffer
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include "buffer.h"
/*
* Writes a character to the buffer
*/
void writeToBuffer(Buffer *b, char c, int position)
{
import java.util.Arrays;
public class part1c {
public static char[] shift(char[] input, int shiftNum) {
char[] firstHalf = Arrays.copyOfRange(input, 0, shiftNum);
char[] secondHalf = Arrays.copyOfRange(input, shiftNum, input.length);
for(int i = 0; i < (input.length - shiftNum); i++) {
input[i] = secondHalf[i];
}
"""Support utilities for COMP28512.
(C) University of Manchester 2015
Author: Andrew Mundy
Revisions
---------
31/01/2015:
Included `get_pesq_scores` and generally neatened.
05/02/2015:
@Todd-Davies
Todd-Davies / addressing.s
Last active July 21, 2018 09:38
ARM Addressing modes
; Addressing modes
; ================
; Here we write a program to add up the numbers in a table.
; We do it in four different ways to illustrate different methods of addressing
; in ARM Assembly.
; To compile/run, open Komodo with the command:
; start_komodo 15111
; Then open, compile and run this file as normal.
import java.util.Arrays;
public class Queens {
public static final int SIZE = 8;
public static void main(String[] args) {
int grid[][] = new int[SIZE][SIZE];
int soln[] = new int[SIZE];
nQ(grid, 0, soln);