Skip to content

Instantly share code, notes, and snippets.

View tnvmadhav's full-sized avatar
🐎
Dedicating my Heart

TnvMadhav tnvmadhav

🐎
Dedicating my Heart
View GitHub Profile
@tnvmadhav
tnvmadhav / tdd.sh
Created October 14, 2024 04:10 — forked from codeinthehole/tdd.sh
A Bash script for running an iterative TDD loop using an LLM to make a set of tests pass
#!/usr/bin/env bash
#
# A Bash script to run a TDD loop for building a Python module to pass tests.
set -euo pipefail
# How many times to loop.
ATTEMPTS=4
# The system prompt to use when creating the initial version.
@tnvmadhav
tnvmadhav / Multi-Column-Automation-Notion-API.py
Created July 27, 2023 15:02
Python Client making HTTP request to Notion to add two columns and some data inside it
import requests
import json
url = "https://api.notion.com/v1/blocks/<your-block-id-here>/children"
payload = json.dumps({
"children": [
{
"object": "block",
"type": "column_list",
@tnvmadhav
tnvmadhav / meeting_rooms_2.py
Created July 9, 2023 06:24
Peak Number of Meeting Rooms Needed
from typing import List
from collections import defaultdict
class Solution:
def min_meeting_rooms_worse(self, intervals: List[List[int]]) -> int:
"""
TC: O(N^2), SC: O(N)
"""
room_dict = defaultdict(list)
@tnvmadhav
tnvmadhav / peak_audience.py
Last active July 9, 2023 06:22
Finding Peak Audience Count for a given list of events by start and end times (integers)
from collections import defaultdict
class ManageIntervals:
def __init__(self):
self.my_dict = defaultdict(int)
self.mx = 0
# O(1)

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

//
// ShareViewController.swift
//
// Created by TnvMadhav on 22/03/23.
import UIKit
import SwiftUI
@objc(PrincipalClassName)
class ShareViewController: UIViewController {