Skip to content

Instantly share code, notes, and snippets.

View tylerkahn's full-sized avatar

Tyler Kahn tylerkahn

  • 22:42 (UTC -05:00)
View GitHub Profile
@tylerkahn
tylerkahn / script.js
Created March 15, 2023 02:49
Tampermonkey script for formatting math equations within the ChatGPT UI
// ==UserScript==
// @name Render LaTeX Equations with KaTeX
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Automatically display properly formatted LaTeX equations from AI output
// @author You
// @match chat.openai.com
// @grant GM_addStyle
// @require https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.18/katex.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.18/contrib/auto-render.min.js
@tylerkahn
tylerkahn / gist:5542129
Created May 8, 2013 17:40
index-via-relay.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<title>Sysstat Widgets Demo</title>
<!-- To use the widgets in your page, include the line below
@tylerkahn
tylerkahn / _.md
Created March 17, 2013 19:20
fundamental and harmonics
@tylerkahn
tylerkahn / _.md
Created March 17, 2013 03:20
fundamental and harmonics
def add1(arr, val, n)
if n.zero?
return arr.map! {|i| i == val ? i+1 : i }
else
arr.each_index do |j|
if arr[n < 0 ? -j - 1 : j] == val
arr[n < 0 ? -j - 1 : j] += 1
n = n - (n < 0 ? -1 : 1)
return arr if n.zero?
end
@tylerkahn
tylerkahn / CryptarithmeticSolver.py
Created March 27, 2011 05:23
Usage: `python CryptarithmeticSolver.py eat that apple`
import itertools
import sys
import time
def factorial(n):
return reduce(int.__mul__, range(1, n+1), 1)
def main():
words = map(str.lower, sys.argv[1:])
uniqueLetters = set(reduce(str.__add__, words))
from IntervalTree import IntervalTree
class ScheduleItem:
def __init__(self, course_number, start_time, end_time):
self.course_number = course_number
self.start_time = start_time
self.end_time = end_time
def get_begin(self):
return minutes_from_midnight(self.start_time)
def get_end(self):
from IntervalTree import IntervalTree
class ScheduleItem:
def __init__(self, course_number, start_time, end_time):
self.course_number = course_number
self.start_time = start_time
self.end_time = end_time
def get_begin(self):
return minutes_from_midnight(self.start_time)
def get_end(self):