Skip to content

Instantly share code, notes, and snippets.

@teddygroves
teddygroves / interpolation.stan
Created June 24, 2022 10:21
Interpolation example
functions {
real interpolate_linear(vector z, vector ts, real t){
/* Equation from https://en.wikipedia.org/wiki/Linear_interpolation */
for (i in 1:rows(ts)-1){
if ((ts[i] < t) && (ts[i+1] > t)){
return z[i] + (t - ts[i]) * (z[i + 1] - z[i]) / (ts[i + 1] - ts[i]);
}
}
reject("Bad inputs: ", z, ts, t);
}
@teddygroves
teddygroves / get_wordle_probs.py
Last active January 8, 2022 11:34
A script I wrote to try and find the best starting word in wordle
"""Find the most common letters in five letter English words at each position.
This is to help you play wordle (https://www.powerlanguage.co.uk/wordle/)
"""
import requests
URL = "https://raw.githubusercontent.com/dwyl/english-words/master/words_alpha.txt"
Debugger entered--Lisp error: (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
(split-string (s-format format-string #'(lambda (fields-string) (car (split-string fields-string ":")))) "[ ]+")
(closure (crm-separator t) (format-string) (split-string (s-format format-string #'(lambda (fields-string) (car (split-string fields-string ":")))) "[ ]+"))("${author editor:30} ${date year issued:4} ...")
mapcar((closure (crm-separator t) (format-string) (split-string (s-format format-string #'(lambda (fields-string) (car (split-string fields-string ":")))) "[ ]+")) ("${author editor:30} ${date year issued:4} ..." " ${=key= id:15} ${=type=:12} ${tags..."))
#f(compiled-function #'sequence #<bytecode 0x1848f6065ad47df4>)((closure (crm-separator t) (format-string) (split-string (s-format format-string #'(lambda (fields-string) (car (split-string fields-string ":")))) "[ ]+")) ("${author editor:30} ${date year issued:4} ..." " ${=key= id:15} ${=type=:12} ${ta
@teddygroves
teddygroves / gist:df7e2eeb62951bbb841018cba8746063
Created August 26, 2021 14:18
bibtex actions commit f6862f6 debug output
Debugger entered--Lisp error: (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
(split-string (s-format format-string #'(lambda (fields-string) (car (split-string fields-string ":")))) "[ ]+")
(closure (crm-separator t) (format-string) (split-string (s-format format-string #'(lambda (fields-string) (car (split-string fields-string ":")))) "[ ]+"))("${author editor:30} ${date year issued:4} ...")
mapcar((closure (crm-separator t) (format-string) (split-string (s-format format-string #'(lambda (fields-string) (car (split-string fields-string ":")))) "[ ]+")) ("${author editor:30} ${date year issued:4} ..." " ${=key= id:15} ${=type=:12} ${tags..."))
#f(compiled-function #'sequence #<bytecode 0x1848f6065a957df4>)((closure (crm-separator t) (format-string) (split-string (s-format format-string #'(lambda (fields-string) (car (split-string fields-string ":")))) "[ ]+")) ("${author editor:30} ${date year issued:4} ..." " ${=key= id:15} ${=type=:12} ${ta
import cmdstanpy
MODEL_FILE = "likert_comparison.stan"
DATA = {
"K": 3,
"N_pre": 30,
"N_post": 29,
"pre": [1] * 14 + [2] * 12 + [3] * 4,
"post": [1] * 6 + [2] * 13 + [3] * 10
}