Skip to content

Instantly share code, notes, and snippets.

View hamishdickson's full-sized avatar
🥔
I like cake.

Hamish Dickson hamishdickson

🥔
I like cake.
View GitHub Profile
Rossa H1
The single most important thing that me and Christshon want you to know, is that even if there are still some things you don’t like or don't relate to… he’ll always be your boy, the kid you raised, the kid you love. You made him who he is today… (beat) and he loves you so much for that.
Spider H1
The single most important thing that me and Oscar want you to know, is that even if there are some things you don’t relate to… they’re still your beautiful grandchild, the kid you’ve always loved. And they love you so, so much and are forever grateful for the role you’ve played in their life.
China H1
The most important thing China wants you to know is that even if modeling isn't the path you'd imagined for her, she’s happy and fulfilled, and she's forever grateful for everything you've taught her in life and the role you've played in making her who she is today.
ちながママに知ってもらいたい最も大事ことは、たとえモデルの仕事が想像していた道ではなかったとしても、ちなは幸せで充実しています。ママがこれまでの人生でちなに教えてくれたこと、そしてママがいまのちなに成長するためにしてくれたことすべてに対して感謝しているしこれからもずっとその気持ちはかわり
async def chat_completion():
"""Retrieve text from OpenAI and pass it to the text-to-speech function."""
# Existing code ...
print(f"time to generate response: {time.time() - start}")
# Select a filler word randomly and send it for synthesis
filler_word = random.choice(["um", "er", "hmm"])
await send_filler_to_speech(filler_word, CONFIG.voice_id)
@hamishdickson
hamishdickson / ast.py
Last active January 22, 2023 17:54
Mini programming language in python 3.10
"""
Please note the python 3.10 magic I was exploring here is in `def interpreter` check it out on line 156, everything else is
basically boilerplate
"""
from dataclasses import dataclass
from typing import Callable
####################################################################
"""
TL; DR: I got annoyed with the way unknown_word_tokens were dealt with in keras
"""
pad_token = 0
unknown_word_token = 1
# tune this
min_occurances = 3
max_len = 60
import cats._
import cats.data._
import cats.implicits._
import shapeless._
object GeneralShow {
implicit val hnilShow = Show.show[HNil](_ => "")
implicit def hconsShow[H, T <: HList](
implicit

Proof that if (S, ⊕) forms a semilattice, then so does (case class C(s: S), ⊕')

A Semilattice consists of a set S and a closed binary operation which is

  1. associative, ie ∀ x, y, z ∈ S: x ⊕ (y ⊕ z) = (x ⊕ y) ⊕ z
  2. commutative, ie ∀ x, y ∈ S: x ⊕ y = y ⊕ x
  3. idempotent, ie ∀ x ∈ S: x ⊕ x = x

if we have some type S and some binary function which together form a Semilattice, then can we define a case class C(s: S) which is also a Semilattice?

package playing
/*
example of f-bounded polymorphism
*/
object Playing {
trait A[T <: Foo[_]] {
type O
def f(t: T): O
@hamishdickson
hamishdickson / binary.idr
Created March 6, 2017 17:30
binary search tree
-- binary search tree
insert : Ord elem => elem -> Tree elem -> Tree elem
insert x Empty = Node Empty x Empty
insert x (Node left val right) = case compare x val of
LT => Node (insert x left) val right
EQ => Node left val right
GT => Node left val (insert x right)
import Data.Vect
insert : Ord elem => (x : elem) -> (xsSorted : Vect k elem) -> Vect (S k) elem
insert x [] = [x]
insert x (y :: xs) = case x < y of
False => y :: insert x xs
True => x :: y :: xs
insSort : Ord elem => Vect n elem -> Vect n elem
insSort [] = []
@hamishdickson
hamishdickson / learn.md
Created February 22, 2017 15:12
stuff I need to learn

Stuff I really need to read up more on

profunctors (basically all of typeclassopedia) HLLs flink (basically all of it) kafka (... ditto) more shapeless