Skip to content

Instantly share code, notes, and snippets.

View jadudm's full-sized avatar

Matthew Jadud jadudm

View GitHub Profile
@jadudm
jadudm / halfadder.c
Last active October 14, 2015 23:45
Some starter code for an exam question.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
/* Constants */
#define NUMBER_OF_TESTS 4
#define A 0
#define B 1
void And (bool a, bool b, bool *out) {
@jadudm
jadudm / price-points.rkt
Created January 12, 2015 17:36
Playing with price points...
(define repeat
(λ (times)
(λ (n)
(cond
[(zero? times)
'()]
[else
(cons n ((repeat (sub1 times)) n))]))))
@jadudm
jadudm / w1-d1-infix.rkt
Created January 9, 2015 02:20
Infix and Prefix
;; This is written in the full Racket language.
#lang racket
(require rackunit rackunit/text-ui)
;; I'll use this definition so tests fail.
;; Replace it with a correct expression in the questions below.
(define FIXME 'FIXME)
;; You can paste this Gist into Dr. Racket and
;; complete your definitions there.
@jadudm
jadudm / install-tinyasm.bash
Last active August 29, 2015 14:11
Installing TinyASM
#!/bin/bash
echo Downloading TinyASM
pushd /tmp
if [ -f tiny.tar.gz ]
then
rm -f tiny.tar.gz
fi
curl -o tiny.tar.gz http://jadud.com/teaching/comporg-f14/resources/tiny.tar.gz
tar xvzf tiny.tar.gz
@jadudm
jadudm / ealu.c
Created October 25, 2014 14:56
EALU Starter Template for Midterm Checkpoint
/* EALU starter file for CSC 335 Midterm Checkup.
* CC0 2014 by Matt Jadud
* Compile with:
* gcc -o ealu ealu.c
* and execute then with
* ./ealu
*/
#include <stdint.h>
#include <stdio.h>
@jadudm
jadudm / Makefile
Last active August 29, 2015 14:07
A simple loop...
all:
gcc -o demo -std=gnu99 demo.c
@jadudm
jadudm / fizzbuzz.c
Created September 10, 2014 18:52
FizzBuzz
/* A short FizzBuzz implementation, primarily for
demonstration of some of the features of C.
To compile this program, at the terminal, type:
gcc fizzbuzz.c
which will give you the executable "a.out".
To run it, type:
@jadudm
jadudm / Makefile
Last active August 29, 2015 14:06
A Square Encoder Reading and Coding Exercise
# QUESTIONS FOR CONSIDERATION
#
CFLAGS=-std=c99 -Wall -g
test: square
gcc ${CFLAGS} -o square_test square.o square_test.c
encoder: square
gcc ${CFLAGS} -o encoder square.o encoder.c
@jadudm
jadudm / gist:366292b2847235a92e5e
Created August 21, 2014 12:19
Bitwise AND of two 8-bit Values
#include <stdio.h>
#include <stdint.h>
void main () {
uint8_t a, b, out;
a = 42;
b = 2;
out = a & b;
@jadudm
jadudm / gist:d890c849f927de8685bd
Created August 21, 2014 12:04
Declaring a Byte
#include <stdio.h>
void main () {
byte b;
b = 1;
}