Write a polite but firm email to a landlord who has not fixed the heating for three weeks. I want the repair, not a fight.
GPT OSS 120B
Subject: Request for Immediate Repair of Heating – Issue Unresolved for 3 Weeks
Dear [Landlord’s Name],
I hope you are well. I am writing to follow up on the heating problem in [Apartment/Unit #], which I first reported on [date of first report]. It has now been three weeks, and the unit remains without adequate heating.
As you know, a functional heating system is essential for a safe and habitable living environment, especially given the current temperatures. I appreciate your past responsiveness to maintenance requests and would like to resolve this matter quickly and amicably.
Could you please arrange for a qualified technician to repair the heating system by **[reasonable deadline – e.g., “the end of the next business day” or “within 48 hours”]?** If there are any obstacles (parts availability, scheduling conflicts, etc.), I would be grateful if you could let me know as soon as possible so we can discuss an alternative plan.
I understand that repairs can sometimes take time, but the prolonged lack of heat is causing discomfort and could lead to further issues (e.g., frozen pipes). I trust we can address this promptly without needing to involve external parties.
Thank you for your immediate attention to this urgent matter. Please confirm the scheduled repair time at your earliest convenience.
Kind regards,
[Your Full Name] [Apartment/Unit #] [Phone Number] [Email Address]
Asked Nov 1, 2026. Unedited.
Write a React hook that debounces a value and cancels on unmount. Include the TypeScript types.
GPT OSS 120B
useDebouncedValue Hook (TypeScript)
import { useState, useEffect, useRef } from 'react';
/**
* Debounce a changing value.
*
* @param value The value that may change frequently (e.g. user input).
* @param delay How long to wait (in ms) after the *last* change before
* updating the debounced value.
* @returns The debounced version of `value`. It only changes after the
* specified `delay` has elapsed without further updates.
*
* The hook also clears the pending timer when the component unmounts,
* preventing stray `setState` calls.
*
* @example
* const [search, setSearch] = useState('');
* const debouncedSearch = useDebouncedValue(search, 500);
* // `debouncedSearch` updates 500 ms after the user stops typing.
*/
export function useDebouncedValue<T>(value: T, delay: number): T {
// The state that will be returned – it always holds the *debounced*
// version of `value`.
const [debounced, setDebounced] = useState<T>(value);
// `timerRef` stores the id of the pending timeout so we can cancel it.
const timerRef = useRef<number | null>(null);
// Keep the latest `value` in a ref so the timeout callback always reads the
// freshest value without needing to re‑create the timeout on every render.
const latestValueRef = useRef<T>(value);
latestValueRef.current = value;
useEffect(() => {
// Clear any existing timer before starting a new one.
if (timerRef.current !== null) {
clearTimeout(timerRef.current);
}
// Start a new timer that will set the debounced value after `delay` ms.
timerRef.current = window.setTimeout(() => {
setDebounced(latestValueRef.current);
timerRef.current = null; // cleanup reference
}, delay);
// Cleanup runs when:
// • `value` or `delay` changes (so we can reset the timer)
// • the component unmounts (so we cancel any pending timer)
return () => {
if (timerRef.current !== null) {
clearTimeout(timerRef.current);
timerRef.current = null;
}
};
// We intentionally **do not** list `debounced` in the dependency array;
// we only care about changes to the incoming `value` and the `delay`.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [value, delay]);
return debounced;
}How It Works
| Step | What Happens |
|---|---|
| 1️⃣ Initial render | debounced is seeded with the current value. |
2️⃣ value changes | useEffect runs: any existing timeout is cleared, then a new setTimeout is scheduled. |
| 3️⃣ Timeout fires | After delay ms without further changes, the callback copies the latest value (stored in latestValueRef) into state, causing a re‑render with the debounced value. |
| 4️⃣ Unmount | The cleanup function clears the pending timeout, guaranteeing that setDebounced will never be called after the component has been removed. |
Usage Example
import React, { useState } from 'react';
import { useDebouncedValue } from './useDebouncedValue';
function SearchBox() {
const [input, setInput] = useState('');
const debouncedInput = useDebouncedValue(input, 500); // 500 ms debounce
// Simulate an API request that runs only when the debounced value changes.
React.useEffect(() => {
if (debouncedInput) {
// fetchResults(debouncedInput) …
console.log('Fetching results for:', debouncedInput);
}
}, [debouncedInput]);
return (
<input
type="text"
value={input}
placeholder="Type to search..."
onChange={e => setInput(e.target.value)}
style={{ width: '300px', padding: '8px' }}
/>
);
}Why This Implementation Is Safe
Generic typing (
<T>) – works with any value type (string, number, object, etc.).Timer clean‑up on unmount – the cleanup function in
useEffectguarantees no straysetStatecalls after the component disappears.latestValueRef– avoids the “stale closure” problem; the timeout callback always accesses the newest value without needing to recreate the timeout on every render.
Feel free to extend it (e.g., add leading/trailing options) but the core pattern above covers the most common debounce‑on‑value‑change scenario with proper TypeScript support.
Asked Nov 1, 2026. Unedited.
A drug test is 99% accurate, and 0.5% of people use the drug. Someone tests positive. What is the probability they use it, and why does the answer surprise people?
GPT OSS 120B
The calculation
| Drug user (prevalence = 0.5 %) | Non‑user (prevalence = 99.5 %) | |
|---|---|---|
| Test positive | 99 % of users → (0.99 \times 0.005 = 0.00495) | 1 % of non‑users → (0.01 \times 0.995 = 0.00995) |
| Test negative | 1 % of users → (0.01 \times 0.005 = 0.00005) | 99 % of non‑users → (0.99 \times 0.995 = 0.98505) |
The probability that a randomly chosen person tests positive is the sum of the two positive‑outcome cells:
[ P(\text{positive}) = 0.00495 + 0.00995 = 0.01490. ]
We want the probability that a positive test actually belongs to a user:
[ \begin{aligned} P(\text{user}\mid\text{positive}) &= \frac{P(\text{positive}\mid\text{user})\,P(\text{user})} {P(\text{positive})} \[4pt] &= \frac{0.99 \times 0.005}{0.01490} \[4pt] &\approx 0.332 \;=\; 33.2\%. \end{aligned} ]
Answer: ≈ 33 % (about one‑third) of people who test positive actually use the drug.
Why the answer surprises most people
Mis‑interpreting “99 % accurate” The statement “the test is 99 % accurate” is often taken to mean “if the test says you’re positive, there’s a 99 % chance you’re really a user.” In reality, “99 % accurate” usually means:
Sensitivity (true‑positive rate) = 99 %: 99 % of actual users test positive.
Specificity (true‑negative rate) = 99 %: 99 % of non‑users test negative.
The required probability is the reverse conditional: (P(\text{user}\mid\text{positive})), not (P(\text{positive}\mid\text{user})).
Base‑rate (prevalence) neglect Only 0.5 % of the population actually uses the drug. Even a tiny false‑positive rate (1 %) applied to the huge 99.5 % of non‑users generates many more false positives than true positives:
True positives: 0.00495 (≈ 5 per 1 000 people)
False positives: 0.00995 (≈ 10 per 1 000 people)
Hence, among all positive results, the majority are false.
Human intuition favors the “law of small numbers” We tend to think of a single test result in isolation, ignoring the overall population composition. When the base rate is low, the intuition that a “good” test should give a good answer fails.
Quick intuitive check
Imagine testing 10 000 people.
| Category | Count |
|---|---|
| Actual users (0.5 %) | 50 |
| – Test positive (99 % of users) | 49 |
| – Test negative (1 % of users) | 1 |
| Non‑users (99.5 %) | 9 950 |
| – Test positive (1 % false‑positive) | 99.5 ≈ 100 |
| – Test negative (99 % correctly) | 9 850 |
Total positives = 49 + 100 ≈ 149. Only 49 of those are real users: (49/149 \approx 33\%).
Take‑away
A test’s sensitivity and specificity tell you how it behaves given a person’s true status, but the probability you care about after a positive result also depends crucially on how common the condition is in the population. When the prevalence (base rate) is low, even an excellent test can give a surprisingly low chance that a positive result reflects the true condition. This is the classic base‑rate fallacy, and it’s why the 33 % answer often feels counter‑intuitive.
Asked Nov 1, 2026. Unedited.
What it’s good at
Ranked against 42 models, from public leaderboards and our own blind tests where we have them. How we rank
- #42of 42 for coding
- #42of 42 for writing
- #42of 42 for math
The facts
GPT OSS 120B is OpenAI’s 120-billion-parameter model with open weights. It works in text only.
Scores from artificialanalysis.ai and lmarena.ai.
- Made by
- OpenAI
- API price, per 1M tokens
- $0.10 in, $0.50 out
- Speed
- 238 tokens a second
- Artificial Analysis Index
- 11.6
- LMArena text
- 1,366
- LMArena coding
- 1,379
- Updated
- Oct 26, 2026