Skip to content

Instantly share code, notes, and snippets.

View ajarmst's full-sized avatar

AJ Armstrong ajarmst

  • Northern Alberta Institute of Technology
  • Edmonton, Canada
View GitHub Profile
@ajarmst
ajarmst / Main.c
Last active February 11, 2021 04:41
Testing purposes only
oogahbooga
#include "Bits.h"
#include <assert.h> //for assert()
#include <math.h> //For pow()
typedef unsigned int uint;
typedef unsigned char byte;
int main(int argc, char** argv)
{
@ajarmst
ajarmst / printbinary.c
Created January 31, 2020 17:09
C Function to Print a Number in Binary to Console
//From another instructor. Provided for
//ICA 4, Lab 1
void printInBinary(unsigned char n) {
unsigned char mask = 0x80;
for (int i = 0; i < 8; i++) {
printf("%c ", (n & mask) ? '1' : '0');
mask = mask >> 1;
}
}
@ajarmst
ajarmst / client.py
Created December 5, 2019 20:40
Demo Code for Final PRGM1000 Lecture (cron, socket programming)
#!/usr/bin/python3
#Trivial server that sends hello and prints out response.
import socket
def main():
host = '127.0.0.1'
port = 1776
public class Star
{
private static Random _rnd = new Random();
public Point _location { get; private set; }
public Color _color { get; private set; }
public int _size { get; private set; }
public Star( Point p )
{
_location = p;
_color = GDIDrawer.RandColor.GetColor();
@ajarmst
ajarmst / classes.cs
Created November 13, 2019 17:01
classes.cs
public class Star
{
private static Random _rnd = new Random();
public Point _location { get; private set; }
public Color _color { get; private set; }
public int _size { get; private set; }
public Star( Point p )
{
_location = p;
_color = GDIDrawer.RandColor.GetColor();
@ajarmst
ajarmst / files.py
Created October 24, 2019 19:13
File I/O Demo
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 24 12:24:01 2019
@author: aja
"""
#File IO Demo
colours = ["Red","Purple","Blue","Orange", "Black", "Pink","Indigo","Periwinkle","Gold",
"Green", "Midnight Grey", "Beige", "maroon", "burgundy","mauve",
@ajarmst
ajarmst / collarg.py
Created October 24, 2019 18:10
In-Class Demo Code for Collections and Argv
# -*- coding: utf-8 -*-
# Name: AJ Armstrong
# Course/Class: PRGM1000/A02
# Description: Demonstration of some Collections
# Date: 22 Oct 2019
# Version: 1.0
import sys
stooges = ["Larry", "Moe", "Curly", "Curly Joe"]
@ajarmst
ajarmst / misc.py
Created October 18, 2019 15:40
Python Demo Illustrating Some Recent Concepts
#!/usr/bin/python3
#The above is a 'shebang' used to tell linux/bash that
#this is a python3 script if I run it in the shell.
import sys
import random
def WholeNump(value): #Expecting a string
if len(value) <= 0: return False
for c in value: #iterate through chars
@ajarmst
ajarmst / loops.py
Last active October 11, 2019 12:32
Demo Code for Iteration
print("Loop Demos")
# i = 5
# while i < 5:
# print (str(i) + "!")
# i+=1 #(i = i+1)
# print("All done.")
# i = 5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo_5
{
class Program
{