Skip to content

Instantly share code, notes, and snippets.

View winfamy's full-sized avatar

Grady Phillips winfamy

View GitHub Profile
@winfamy
winfamy / example.S
Last active March 22, 2021 05:17
CS 351
COPYBYTE1TO3
ADR R4, MyString ; copy address of MyString into R4
ADR R5, NewString
LDRB R6, [R4], #4 ; load the first byte pointed to by the address
; in the R4 register into R5, then increments
; address R4 by 4.
;
; reason we want to increment the address by 4 is that
; each byte in the string that we're copying is located
; at the end of words, i.e. it's laid out like
void * PPcpu (void * param){
int myID = ((cpuParams*) param)->threadNumber;
sharedVars * shared = ((cpuParams*) param)->svars;
process * runningProcess = NULL;
bool processChanged = false;
while(1) {
// reset flag
processChanged = false;
void* RRcpu (void* param){
int myID = ((cpuParams*)param)->threadNumber;
sharedVars * shared = ((cpuParams*)param)->svars;
process * runningProcess = NULL;
int quantumLeft = shared->quantum;
bool stillProcessingQuantum = false;
while (1) {
// wait for "uptick" from main
sem_wait(&(shared->cpuSems[myID]));
#include <stdio.h>
#include "CPUs.h"
#include "processQueue.h"
#include "helpers.h"
void* FIFOcpu (void* param){
int myID = ((cpuParams*)param)->threadNumber;
sharedVars* shared=((cpuParams*)param)->svars;
process* myProcess=NULL;
while(1) {
import os
import board
from digitalio import DigitalInOut, Direction
import time
import touchio
import supervisor
# .4054 = full beat
# [abs_time, led, event]
full_beat = .4054
@winfamy
winfamy / seed-database.php
Created May 12, 2021 21:14
Seed script for CGOC
<?php
namespace CGOC\Web\Endpoints;
use Faker\Factory;
use CGOC\Models\ActivityReport;
use CGOC\Models\ActivityReportFile;
use CGOC\Models\Base;
use CGOC\Models\Branch;
use CGOC\Models\BranchMembership;
@winfamy
winfamy / api.py
Created June 4, 2021 14:49
json-rpc
"""
Definitions of API endpoints and possible cmds can be found in tool/cmd_tlm_server/api.rb
Those of note upon first review:
- cmd_no_hazardous_check
- get_cmd_list
- get_tlm_list
- get_tlm_item_list
- get_tlm_details
- inject_tlm
import numpy as np
from scipy.spatial.transform import Rotation
import rmsd
from catalog_var import catalog
def parse_file(filename):
entries = []
with open(filename, 'r') as f:
content = f.readlines()
import hashlib
import math
charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
def convert_to_base62(x):
built_str = ""
if (x == 0):
return "0"
@winfamy
winfamy / leetcode.js
Created May 9, 2022 19:18
17. Letter Combinations of a Phone Number
/**
* @param {string} digits
* @return {string[]}
*/
var letterCombinations = function(digits) {
if(digits.length == 0) return []
let map = {
"2": ["a", "b", "c"],
"3": ["d", "e", "f"],