Skip to content

Instantly share code, notes, and snippets.

View kierdavis's full-sized avatar

Kier Davis kierdavis

View GitHub Profile
// All possible types of packet. Packet types are 8-bit integers.
typedef enum {
// Packet type 0x00 is reserved in case we need some form of "null packet"/"absence of a packet"
// Move the cursor position to new coordinates.
// Payload is two 16-bit integers, which are the x and y coordinates to move to.
PACKET_TYPE_MOVE_TO = 0x01;
// Draw a line from the cursor position to the given coordinates, then update
// the cursor position to these new coordinates.
  • Pack some chairs up - we're gonna need some floor space!
  • Physically move everything in the broomcupboard into the rest of the room
    • Rename /southampton/broomcupboard to /southampton/floor
    • (Things that are unwieldy can be left in there, so long as we are sure that the inventory exactly matches real life at the end of this step)
  • Move small loose items into RUBs, and move things between RUBs if necessary
  • Re-inventorise each RUB / other container
    • Update the inventory as this is done
  • Determine an optimal packing strategy for the cupboard (could discuss this while eating?)
    • Try to keep things used that are used regularly on the left-hand side of the cupboard
  • Try to put heavy, less regularly used stuff (read: old kits) at the bottom of the stacks
NORTH WALL
---- Team #1 ---- Team #2 -----
| |
| (T) (T) (T) |
| |
| (T) (T) (T) |
Receptacle(W) | | Receptacle(E)
| (T) (T) (T) |
| |
| |
type
MyObject = object
case kind: int # This defines a new field called 'kind' of type 'int'. Additionally, the value of this field determines what other fields are present in the object.
of 1:
field1: Type1
of 2:
field2: Type2
of 3, 4:
field3: Type3
field4: Type4
# define and initialise a set
var states: set[char] = {}
# iterate over each character of each string in 'chains'
for s in chains:
for c in s:
states.incl(c) # add character to the set
typedef struct {
int a;
char *b;
uint8_t c;
} mystruct;
void call_and_unpack(int *a, char **b, uint8_t *c) {
mystruct s = myfunction();
*a = s.a;
*b = s.b;
==> Making package: fritzing 0.9.3b-1 (Mon 4 Jul 14:27:28 BST 2016)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Downloading 0.9.3b.tar.gz...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 129 0 129 0 0 253 0 --:--:-- --:--:-- --:--:-- 253
100 12.5M 100 12.5M 0 0 894k 0 0:00:14 0:00:14 --:--:-- 936k
-> Downloading 667a5360e53e8951e5ca6c952ae928f7077a9d5e.tar.gz...
; IO port constants
.define IO_GPOUT0 0
.define IO_GPOUT1 1
.define IO_GPOUT2 2
.define IO_CTRL 3
.define IO_GPIN0 4
.define IO_SS0 4
.define IO_GPIN1 5
.define IO_SS1 5
.define IO_GPIN2 6
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define ITERATIONS 10000000
uint16_t get_password_hash(const char *password, int password_len) {
register uint16_t hash = 0;
register int char_index = password_len;
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define ITERATIONS 1000000
uint16_t get_password_hash(const char *password, int password_len) {
register uint16_t hash = 0;
register int char_index = password_len;