Skip to content

Instantly share code, notes, and snippets.

View scolton99's full-sized avatar
🐢

Spencer Colton scolton99

🐢
  • Northwestern University
  • Chicago, IL
View GitHub Profile
@scolton99
scolton99 / footprints.js
Created August 10, 2018 13:32
Generating a textual list of assignment groups in BMC FootPrints
(function () {
let referralBox = document.getElementsByName("fieldArea0")[0];
let groups = referralBox.querySelectorAll("option");
let txt = "";
groups.forEach(
function (e) {
if (e.textContent === "+Individual Users")
@scolton99
scolton99 / jj.js
Created December 9, 2019 06:17
Text Cycler for JJ <3
(() => {
const hi_dom = document.getElementById("sqs-slash-page-header");
let hello_index = 0;
const display_time = 4500;
const fade_out_time = 500;
const fade_in_time = 500;
const buffer = 30;
const hellos = [
@scolton99
scolton99 / stats.sql
Last active March 18, 2020 04:04
Fetch ticket stats from FP.
SELECT
COUNT(*),
submission__btracking,
mrUSERID
FROM
(
SELECT
DISTINCT MASTER1.mrID,
MASTER1.submission__btracking,
MASTER1_FIELDHISTORY.mrUSERID
@scolton99
scolton99 / csvtojson.js
Created July 23, 2020 18:05
CSV Parser for AWS DynamoDB
const csv = require('csvtojson');
const fs = require('fs');
const files = [];
const colParserBool = item => {
return item === "true";
};
const colParserStringSet = item => {
@scolton99
scolton99 / html-boilerplate.html
Last active December 28, 2020 03:13
Basic code for setting up any HTML document.
<!DOCTYPE html>
<html>
<head>
<!-- Import JavaScript and CSS here -->
<!--
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
-->
<!-- End Import JavaScript and CSS -->
@scolton99
scolton99 / lttng.sh
Created February 9, 2021 23:06
Scripts used to collect data (NU CS 450 WQ21, Project 2). Not meant to be run as one script; instead parts should be split up and renamed.
# all <-- main script
# ==========================
sudo ./lttng
if [ $1 = 'docker' ]; then
./docker
else
./lxc
fi
sudo ./dlttng
@scolton99
scolton99 / vector_map.cpp
Created February 16, 2021 15:41
C++ Vector Map
#include <functional>
#include <iterator>
#include <vector>
#include <iostream>
namespace std {
template<typename S, typename E>
vector<E> vector_map(typename std::vector<S>::iterator start, typename std::vector<S>::iterator end, std::function<E(S)> lambda) {
vector<E> ret;
@scolton99
scolton99 / union.c
Last active February 16, 2021 20:41
C Union Demo
#include <stdio.h>
typedef union U1 {
int a[2];
char c;
short s;
} U1;
int main() {
long long tmp;
@scolton99
scolton99 / alignment.c
Created February 16, 2021 21:10
A test of alignment requirements in C.
#include <stdio.h>
#include <stdlib.h>
int main() {
char* tmp = (char*)(malloc(2 * sizeof(long long)));
printf("Found pointer: 0x%llX\n", (unsigned long long)tmp);
unsigned long long* dbl = (long long*)(tmp + 2);
printf("Cast pointer location (+ 2): 0x%llX\n", (unsigned long long)dbl);
@scolton99
scolton99 / complex_struct_union.c
Created March 1, 2021 16:23
Example of how to access elements of structs and unions in C.
#include <stdio.h>
struct example;
union u {
struct example *access;
int c;
short d;
};