Skip to content

Instantly share code, notes, and snippets.

View saahityaedams's full-sized avatar

Saahitya Edamadaka saahityaedams

View GitHub Profile
#lang racket
(define input
(port->lines (open-input-file "input5.in")))
(define (find-row lower upper seq)
(cond
[(equal? (string-length seq) 0) lower]
[(equal? (string-ref seq 0) #\F) (find-row lower (/ (+ lower upper (- 1)) 2) (substring seq 1))]
[(equal? (string-ref seq 0) #\B) (find-row (/ (+ lower upper 1) 2) upper (substring seq 1))]
#lang racket
(define input
(port->lines (open-input-file "input6.in")))
; for Section 1
; (define (split-groups gs)
; (let aux [(in gs) (curr-g "") (out `())]
; (cond
; [(null? (cdr in)) (cons curr-g out)]
@saahityaedams
saahityaedams / virtual_machine.py
Created April 15, 2021 09:47
Synacor challenge - Implemented a VM to run the binary
from enum import IntEnum
REGISTER_COUNT = 8
class Ops(IntEnum):
HALT = 0
SET = 1
PUSH = 2
POP = 3
EQ = 4
GT = 5
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
/*
Advent of Code 2020 - Day 15
*/
# wrapper for calling LLM with an image
# eg. make_moondream_ollama_request /tmp/out.jpeg "is the image black and white ? "
# eg. make_moondream_ollama_request /tmp/out.jpeg
make_moondream_ollama_request() {
local file_path=$1
local model="moondream"
local prompt=${2:-"Describe the image?"}
local api_url="http://localhost:11434/api/generate"
@saahityaedams
saahityaedams / instructions.md
Created January 23, 2025 15:53
download amazon item price history
  1. Goto pricehistory.app and enter the url of item you want the price history of.
  2. Open the browser console and run the following function.
function downloadPriceDataIntoCSV() {
  
    price_series = chart.data.datasets.filter(item => item.label == "Prices")[0].data
    
    // Create CSV header
    const headers = ['price,datetime\n'];
    
#!/bin/bash
AWS_PROFILE="example-profile"
LOG_GROUP="/ecs/example-task"
LOG_STREAM="ecs/container/abcdef1234567890"
FILE="logs.txt"
> "$FILE"
TOKEN=""
@saahityaedams
saahityaedams / scrub_epub_images.py
Created January 2, 2026 04:04
Utility script to scrub images from an epub
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "pillow",
# ]
# ///
"""Remove images from an EPUB file with interactive prompts."""
import zipfile