Skip to content

Instantly share code, notes, and snippets.

View Jamesscn's full-sized avatar

James Scoon Jamesscn

View GitHub Profile
@Jamesscn
Jamesscn / grapher.py
Created December 16, 2022 06:43
Python Grapher
#!/usr/bin/python3
import json, os, re
from rich import print
from typing import Tuple, Dict
html_template = """
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
@Jamesscn
Jamesscn / tictactoe.c
Last active February 3, 2024 23:04
Linux Tic Tac Toe Driver
#include <linux/module.h>
#include <linux/cdev.h>
#include <linux/fs.h>
#define DRIVER_NAME "tictactoe"
#define MAJOR_NUMBER 168
/*
Create the character device with the following commands:
$ sudo mknod /dev/tictactoe c 168 0
@Jamesscn
Jamesscn / cat.c
Created August 6, 2021 03:14
A program that behaves like the UNIX cat function, which I made in order to learn about file I/O in Linux systems.
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#define bufferSize 1024
@Jamesscn
Jamesscn / MPPT.c
Created November 26, 2019 08:14
This is the base code of a MPPT that will be implemented in a rural community in order to maximise the power output of their solar panels.
//This code will look to maximise the IV curve output of the solar panel
#include <stdbool.h> //To be able to use boolean variables and 'true' and 'false' values
//These will be replaced with a better model and finally the real readings
double readVoltage() {
return 24;
}
//These will be replaced with a better model and finally the real readings
@Jamesscn
Jamesscn / Bitset.cpp
Last active October 27, 2019 11:17
Bitset class implementation in C++
#include <iostream>
#include <vector>
#include <limits>
#include <cmath>
using namespace std;
class Bitset {
private:
typedef unsigned long long int bitData; //Change this datatype if you want different subset sizes