Skip to content

Instantly share code, notes, and snippets.

View angusbarnes's full-sized avatar
🍎
Working on too many things

Angus Barnes angusbarnes

🍎
Working on too many things
View GitHub Profile
import RPi.GPIO as GPIO
import time
#GPIO Mode (BOARD / BCM)
GPIO.setmode(GPIO.BCM)
# Define the update rate of this program
# Avoid large values as this will needlessly cycle and heat
# the BCM chip on the board. In theory this value could be as
# low as 0.5 - 1 Hz given our usecase, but 50 is used for responsivity

Understanding Digital Abstractions

You gotta start somewhere


If you are reading this you are probably already aware of the fundamental components of a computing system. RAM, CPU, and SSD are all common vernacular these days. What you might not know, is why these components are important or how we use them to compute tasks.

The Turing machine

Before we go on, it is important we establish a definition for 'computer'. Its one of those words we all know, but maybe don't quite understand. As with any word. the meaning differs based on context. At its most basic, a computer is a 'machine' or 'system' capable of computing a simple boolean task. That is to say, a computer must be able to make yes or no decisions. This is a nice definition however it falls a little flat of what we're aiming for. You see, modern computers are able to make billions of yes/no decisions asynchronously. This is where 'The Turing Machine' definition comes in handy.

Alan Turing was a man born in 1912. Alongside breaking the enigm

#include <stdio.h>
#define INTERNAL_FUNC static // Sementic distinction for functions designed for internal use only
/*
* These are functions specific to use on the linux platfrom.
* Unix and POSIX platforms define terminal color modes which can
* be set using escapre sequences on the standard output stream.
* These are not available on windows by default. Modern windows
* builds do support this ANSI color codes via terminal emulation
* however there is not way to detect this currently. As a result,
{
"temps/c" : {
"source" : "gist.github.com/someurl"
}
}
NOTICE:
These notes are provided with the intention to be helpful when revising.
These notes have been written by students and therefore there can be no guarantee
that these notes are factually accurate. You should always do your own research. 
Also note that every effort has been put towards sourcing 'factual' claims however you
should ensure that these sources are trustworthy before using them.

Permissions:
- YOU MAY NOT DIRECTLY COPY THESE NOTES IN ANY WORK

Clean code challenge #1: FizzBuzz


FiizBuzz is a simple game often used to challenge new coders skills and thinking ability. The rules are easy:

  1. Your program should print all the numbers from 1-100
  2. Any number which is a multiple of three should be printed as "Fizz" instead of the number
  3. Any number which is a multiple of five should be printed as "Buzz" instead of the number
  4. Any number which is a multiple of both three and five should be printed as "FizzBuzz"

HINT: To get the remainder of a divison use the modulo operator (%).

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Orbis {
namespace Timing{
public class Timer
{
class VehicleSize(Enum):
MOTORCYCLE = 0
COMPACT = 1
LARGE = 2
class Vehicle(metaclass=ABCMeta):
def __init__(self, vehicle_size, license_plate, spot_size):
@angusbarnes
angusbarnes / FizzBuzz.cs
Created June 19, 2018 04:59
FizzBuzz implementation
using System;
void Main() {
for (i = 0; i <= 100; i++) {
Print((i % 15) ? "FizzBuzz" : (i % 5) ? "Buzz" : (i % 3) ? "Fizz" : i.ToString());
}
}
@angusbarnes
angusbarnes / Lesson1-5.cs
Last active May 6, 2018 08:39
All the code from lesson 1.5
using System;
class MainClass {
public static void Main ()
{
float answer = Maths.Divide(2f, 4f);
int answer2 = Maths.Addition(5, 6);
float somefloat = Maths.pi;
Console.Write(answer2);