Skip to content

Instantly share code, notes, and snippets.

@jmhummel
jmhummel / spotify-playlist-clustering-with-llm.ipynb
Created March 6, 2024 22:22
Uses an LLM to cluster songs from a playlist and create new one
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmhummel
jmhummel / 2022-08-19-express.ipynb
Created August 19, 2022 17:37
Riddler express 2022-08-19
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmhummel
jmhummel / 2022-08-05-express.py
Created August 5, 2022 19:55
Riddler express 2022-08-05
import itertools
total = 0
count = 0
for s1, s2 in itertools.combinations(range(1, 7), 2):
sum_faces = s1 + s2
if sum_faces == 7:
continue # Opposite faces add up to 7
total += sum_faces
count += 1
@jmhummel
jmhummel / 2020-05-22-classic.ipynb
Last active May 22, 2020 22:52
Riddle classic 2020-05-22
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmhummel
jmhummel / 2019-06-21-classic-matrix.py
Created June 24, 2019 03:11
2019-06-21 Riddler Classic
from heapq import heappush, heappop
import numpy as np
from collections import deque
STATES = [(0, 0, 0, 0), (0, 0, 0, 1), (0, 0, 1, 1), (0, 1, 0, 1), (0, 1, 1, 1), (1, 1, 1, 1)]
ACTIONS = STATES[1:]
STATE_MAP = {state: i for i, state in enumerate(STATES)}
ACTION_MAP = {action: i for i, action in enumerate(ACTIONS)}
from timeit import Timer
a = [984, 981, 976, 950, 899, 890, 887, 885, 880, 800, 798, 790, 777, 767, 750, 701, 697, 688, 680, 678, 650, 599, 589,
567, 550, 501, 9, 8, 7, 6, 5, 4, 3, 2, 1]
b = [1090, 1080, 1074, 1065, 1057, 1056, 1047, 1041, 1041, 1038, 1025, 1013, 1008, 992, 991, 991, 991, 978, 977, 959,
945, 935, 925, 925, 923, 915, 908, 904, 901, 901, 900, 897, 894, 882, 880, 876, 866, 854, 849, 849, 833, 818, 818,
812, 811, 809, 798, 794, 793, 788, 772, 763, 747, 746, 743, 737, 736, 734, 732, 730, 728, 718, 714, 713, 706, 701,
699, 691, 690, 689, 681, 672, 663, 656, 654, 653, 652, 651, 646, 644, 640, 637, 637, 635, 634, 633, 630, 625, 621]
@jmhummel
jmhummel / 2019-03-03-express.ipynb
Last active March 4, 2019 04:09
2019-03-03 Riddler (express)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmhummel
jmhummel / 2019-01-11-express.ipynb
Last active January 11, 2019 23:39
2019-01-11 Riddler (express)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmhummel
jmhummel / LICENSE
Created September 30, 2018 08:43
This license applies to all public gists https://gist.github.com/jmhummel
MIT License
Copyright (c) 2018 Jeremy Hummel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: