Skip to content

Instantly share code, notes, and snippets.

@josephyooo
josephyooo / claude-live.py
Created April 23, 2026 22:06
Minimal live viewer for Claude Code sessions.
#!/usr/bin/env python3
"""
Minimal live viewer for Claude Code sessions.
Landing page is a project/session picker; picked session opens a live viewer
that renders assistant text with Markdown + KaTeX.
Usage:
claude-live.py # start server, use picker
claude-live.py --port 7777 # custom port
"""

For those who want to backup their MacOS system using Time Machine but don't have an external storage drive. This is a self-contained guide, heavily based on fragmented information found online.

Disclaimers:

  • Extra steps will be needed if you want to connect through the internet. I could not get this to work.
  • Backing up systems greater than 64 GB may be challenging (see 2.b.6).

0. Prerequisites

  1. A MacOS system (this guide tested on a Macbook Air M3 (2024) running Sonoma 14.3)
  2. A Windows system (tested on an AMD system running Windows 11 Pro 23H2)
  3. Administrative permissions on both systems
@josephyooo
josephyooo / lowpower.sh
Created April 29, 2024 19:34
macOS shortcut to toggle low power mode
if [[ $(pmset -g|grep "lowpowermode"|tail -c 2) == 0 ]]
then
sudo pmset -a lowpowermode 1
else
sudo pmset -a lowpowermode 0
fi
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@josephyooo
josephyooo / FashionMnistClassification.ipynb
Created April 10, 2024 03:51
Class assignment to apply CNNs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@josephyooo
josephyooo / chat_stats.ipynb
Last active April 8, 2024 07:05
Plot some chat statistics from a text file generated by https://github.com/ReagentX/imessage-exporter/tree/develop
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@josephyooo
josephyooo / compare_sorts.py
Created March 18, 2024 22:26
Compare the order of growths of bubble sort, selection sort, and insertion sort given a sorted, unsorted, and reverse sorted input.
from random import shuffle # for unsorted list
def bubble_sort(arr):
n = len(arr)
# run n-1 to ensure array is sorted
for j in range(n-1):
for i in range(n-1):
if arr[i] > arr[i+1]:
arr[i], arr[i+1] = arr[i+1], arr[i]
@josephyooo
josephyooo / visualize_sorting.py
Last active March 18, 2024 22:27
Visualize selection and bubble sort on a string.
def highlight(s):
return f"\033[36m{s}\033[0m"
def switch_elements(l, i1, i2):
# switch elements of list in-place
l[i1], l[i2] = l[i2], l[i1]
def visualize_selection_sort(l):
# l: list of characters to be sorted
l = [ord(c) for c in l]
@josephyooo
josephyooo / trapz_vs_simps.py
Created November 29, 2023 17:14
Compare error convergence of two quadratures. Also includes Newton's method, Bisection method, and extrema finder functions.
from math import sqrt, pi, e, ceil
# NUMERICAL INTEGRATIOn
def trapezoidal(f, a, b, n):
# init h and x_j
h = (b - a) / n
x = lambda j: a + j * h
# compute and return quadrature
return h / 2 * (f(a) + 2 * sum([f(x(j)) for j in range(1, n)]) + f(b))
@josephyooo
josephyooo / compare_newton_and_fixed.py
Last active November 29, 2023 17:11
Gets approximate convergence rates of Newton's Method and Fixed Point Iteration for a given f(x), g(x), epsilon, and lambda_0
def newton(f, f_prime, lambda_0, epsilon, maxits=25):
lambdas = [lambda_0]
for i in range(maxits):
lambda_0 = lambdas[-1]
lambda_1 = lambdas[-1] - f(lambdas[-1]) / f_prime(lambdas[-1])
lambdas.append(lambda_1)
if abs(lambda_1 - lambda_0) < epsilon:
return lambdas
return lambdas