Skip to content

Instantly share code, notes, and snippets.

View aholmes's full-sized avatar

Aaron Holmes aholmes

View GitHub Profile
@aholmes
aholmes / chatgpt_compiler.py
Last active December 8, 2022 00:49
A compiler generated by ChatGPT.
# This is a tokenizer, parser, and compiler that has been mostly generated by ChatGPT.
# A handful of errors have been corrected, as well as the addition of the ";" token
# and the ability to write multiple statements in a single line. This last part needed
# to be done by hand because ChatGPT lost the context of the BNF it created somewhere
# along the way, and was not able to regenerate a tokenizer/parser/compiler that
# worked with the original BNF.
#
# 94.42% of this code was created by ChatGPT (see differences.patch for more information).
#
# The conversation can be read here:
from typing import List, Iterator
from markdown_it import MarkdownIt
from markdown_it.token import Token
class Node:
token: Token|None
nodes: 'List[Node]'
def __init__(self, token: Token|None=None) -> None:
self.token=token
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
public class MyDictionary<T, V>: Dictionary<(string, T), V>
{
private IEnumerable<(string Name, T Value)> GetMembers(object obj)
{
var properties = obj.GetType().GetProperties(BindingFlags.Public).Select(o => (o.Name, Value: (T)o.GetValue(obj)));
@aholmes
aholmes / drumeo_10min_exercise.R
Last active June 15, 2023 17:46
Horrible R code to chart Drumeo 10 minute exercise over a month.
# the csv data
# date,2023-04-08,2023-04-09,2023-04-10,2023-04-11,2023-04-12,2023-04-13,2023-04-14,2023-04-15,2023-04-16,2023-04-17,2023-04-18,2023-04-19,2023-04-20,2023-04-21,2023-04-22,2023-04-23,2023-04-24,2023-04-25,2023-04-26,2023-04-27,2023-04-28,2023-04-29,2023-04-30,2023-05-01,2023-05-02,2023-05-03,2023-05-04,2023-05-05,2023-05-06,2023-05-07,2023-05-08,2023-05-09
# 1min,120,120,125,130,130,135,140,145,145,145,146,147,150,152,155,155,156,157,158,158,158,157,158,158,158,158,158,158,160,160,160,161
# 2min,120,120,125,125,126,130,130,132,133,134,135,140,145,150,150,150,152,152,148,148,149,145,150,151,147,145,147,150,151,151,152,153
# 3min,120,120,122,123,125,127,130,131,132,133,135,136,140,140,142,143,144,145,144,145,146,140,146,146,140,135,145,146,146,146,147,148
# 4min,110,120,115,112,120,122,123,125,124,125,126,127,130,133,135,133,135,130,130,131,132,120,133,130,120,120,135,135,136,136,137,139
function(data, which) {
colors <- c("black","red","green","blue")