Skip to content

Instantly share code, notes, and snippets.

View Queens.java
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);
@Todd-Davies
Todd-Davies / addressing.s
Last active Jul 21, 2018
ARM Addressing modes
View addressing.s
; 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.
View comp28512_utils.py
"""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:
View part1c.java
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];
}
@Todd-Davies
Todd-Davies / buffer.c
Last active Aug 29, 2015
C character buffer
View buffer.c
#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)
{
View nfa_solver.py
# -*- 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 / Executable JSON
Last active Feb 7, 2019
I wanted to see what a programming language that was also parsable JSON would look like. This is what I came up with.
View Executable JSON
"""
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:
View gist:4980504

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:

View index.html
<!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">
@Todd-Davies
Todd-Davies / progress_wheel.pde
Created Aug 18, 2012
Processing progress wheel
View progress_wheel.pde
//===============================================================================================
//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;
You can’t perform that action at this time.