Skip to content

Instantly share code, notes, and snippets.

View EricGustin's full-sized avatar
🌎
I wonder how long my GitHub status can be before it tells me that I can't type a

Eric Gustin EricGustin

🌎
I wonder how long my GitHub status can be before it tells me that I can't type a
View GitHub Profile
@EricGustin
EricGustin / anthropic_tool_search_beta_evals.py
Created November 26, 2025 01:49
Evaluating the performance of Anthropic's tool search with 4000+ Arcade tools
"""
This script provides testing Anthropic's tool search functionality across multiple scenarios.
REQUIRED:
- pip install arcadepy
- pip install anthropic
- export ANTHROPIC_API_KEY=<your_anthropic_api_key>
- export ARCADE_API_KEY=<your_arcade_api_key>
"""
@objc func hitEnemy() {
updateHealthBar()
UIView.animate(withDuration: 0.25, animations: {
self.enemy.transform = CGAffineTransform(scaleX: 0.8, y: 0.8) // Scale the enemy down to 0.8 of its size over 1/4 of a second
}) { _ in
UIView.animate(withDuration: 0.25) {
self.enemy.transform = .identity // Once the enemy is done scaling down in size, have it return to its original size over a period of 1/4 of a second
}
}
}
enemy.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(hitEnemy)))
import UIKit
class ViewController: UIViewController {
private var healthBar: UIProgressView!
private var enemy: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
setUpSubviews()
def distributeItems(items: int, n: int):
itemsPerTurn = []
j = 0 # current turn
numOfItems = n*(n+1)//2 # number of items given during turn 0
while items >= numOfItems:
items -= numOfItems
itemsPerTurn.append(numOfItems)
j += 1
numOfItems = n**2 * j + n*(n+1)//2 # number of items given during turn j
return itemsPerTurn
Operation Example Big O Time Complexity
Length: len(s) O(1)
Add: s.add(2) O(1)
Contains: x in/not in s O(1)
Remove: s.remove(2) O(1)
Discard: s.discard(2) O(1)
Pop: s.pop() O(1)
Clear: s.clear() O(1)
Construct: set(iterable) O(length of iterable)
Operation Example Big O Time Complexity
Index: dict[k] O(1)
Assign: dict[k] = v O(1)
Length: dict(lst) O(1)
Pop: dict.pop(k) O(1)
Pop item: dict.popitem() O(1)
Get a value: dict.get(k) O(1)
Get keys: dict.keys() O(1)
Clear: dict.clear() O(1)
Operation Example Big O Time Complexity
Index: lst[i] O(1)
Assign: lst[i] = 2 O(1)
Length: len(lst) O(1)
Append: lst.append(i) O(1)
Pop: lst.pop() O(1)
Clear: lst.clear() O(1)
Slice: lst[start:end] O(end - start)
Extend: lst.extend(iterable) O(length of iterable)
class SortingAlgorithms:
def quickSort(self, leftIndex, rightIndex, lst) -> int:
def partition(leftIndex, rightIndex, lst):
pivotElement = lst[(leftIndex + rightIndex) // 2]
while leftIndex <= rightIndex:
# Find element on the left of the partition that is greater than the partitionElement
while lst[leftIndex] < pivotElement:
leftIndex += 1
# Find element on the right of the partition that is less than the partitionElement
while lst[rightIndex] > pivotElement:
class SortingAlgorithms:
def mergeSort(self, lst):
if len(lst) > 1:
# Split part of the algorithm
middle = len(lst) // 2 # floor division to find middle of the list
leftList = lst[:middle]
rightList = lst[middle:]
self.mergeSort(leftList) # left side of the list
self.mergeSort(rightList) # right side of the list