Skip to content

Instantly share code, notes, and snippets.

View colejhudson's full-sized avatar
🏎️
gotta go faster

Cole Hudson colejhudson

🏎️
gotta go faster
View GitHub Profile
@colejhudson
colejhudson / main.erl
Last active March 11, 2021 07:26
Lots of nonsense involved in running and/or deploying an Erlang program, this is a small note on how to run one immediately.
% There are two ways to run this file. The first
% is as follows:
%
% $ erlc main.erl
% $ erl -noshell -s main init
%
% Here, `erlc` is compiling the erlang file to beam
% bytecode and writes said bytecode to 'main.beam'.
% Then erl, by default looking in the immediate
% directory, loads any beam files, looks for the
#include <stdio.h>
#define ITOA_CHARS_LEN 16
#define ITOA_CHARS "0123456789ABCDEF"
/* 1. First determine which character to use
* 2. Recurse to a helper with a shared counter, so
* that the first call */
char _itoa(int value, int base, char *str, int size) {
@colejhudson
colejhudson / lisp.c
Created February 5, 2021 05:54
beautiful source code
/* A minimal Lisp interpreter
Copyright 2004 Andru Luvisi
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License , or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@colejhudson
colejhudson / README.md
Created September 25, 2020 16:46
Academic LabView License

Per this lecture from Utah State University's course on propulsion systems, the code M21X71243 will yield access to the academic version of LabView.

@colejhudson
colejhudson / iqp.m
Created September 25, 2020 16:34
An implementation of the interior point method, by Geoffrey J. Gordon, originally copied from https://www.cs.cmu.edu/~ggordon/iqp.m
function [val,primals,duals] = iqp(H,c,A,b,verbose)
% [val,primals,duals] = iqp(H,c,A,b,verbose)
%
% A simple interior point algorithm for solving the quadratic program
% maximize - x'Hx/2 + c'x st Ax+b >= 0
% when H is positive semidefinite. Use H=[] for a linear program.
% Use verbose=[] to turn off messages.
% Detection of infeasibility/unboundedness is not very good: we just
% return NaN if it appears that the optimal solution to either the
@colejhudson
colejhudson / authors.csv
Last active October 13, 2020 21:01
My Amazon wishlist as of 09/23/20 at 3:18:00
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
name
b'Robert Service'
b'H. Fogler'
b'Bruce A. Finlayson'
b'Ken A. Dill'
b'Sarina Bromberg'
b'J.M. Smith'
b'Hendrick Van Ness'
b'Milo D. Koretsky'
b'M. Scott Shell'
const d3 = require('d3')
const alphabet = [...Array(26)].map((_, i) => String.fromCharCode(i + 97))
function randomLetters(count) {
return [...Array(count)]
.map(_ => Math.round(25 * Math.random()))
.map(i => alphabet[i])
}
@colejhudson
colejhudson / sat0.w
Last active October 13, 2020 21:09
Donald Knuth's first attempt at writing a SAT solver in WEB, sourced from his website here: https://www-cs-faculty.stanford.edu/~knuth/programs/sat0.w
\datethis
@*Intro. This program is part of a series of ``SAT-solvers'' that I'm putting
together for my own education as I prepare to write Section 7.2.2.2 of
{\sl The Art of Computer Programming}. My intent is to have a variety of
compatible programs on which I can run experiments to learn how different
approaches work in practice.
Indeed, this is the first of the series --- more precisely the zero-th. I've
tried to write it as a primitive baseline against which I'll be able to measure
various technical improvements that have been discovered in recent years.
@colejhudson
colejhudson / amdkfd.patch
Last active June 5, 2020 08:00
Work In Progress Patch for amdkfd
diff --git a/foo.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index 8c6e47c..d7ff3e4 100644
--- a/foo.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -87,6 +87,10 @@ static int kfd_topology_get_crat_acpi(void *crat_image, size_t *size)
* Fetch the CRAT table from ACPI
*/
status = acpi_get_table(CRAT_SIGNATURE, 0, &crat_table);
+
+ pr_info("CRAT table size: %zd\n", *size);
@colejhudson
colejhudson / exportOptions.plist
Created April 13, 2020 01:13
Create an IPA from an Xcode project.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>development</string>
<key>compileBitcode</key>
<false/>
</dict>
</plist>