Skip to content

Instantly share code, notes, and snippets.

View forestbelton's full-sized avatar

Forest Belton forestbelton

View GitHub Profile
% A keypad lock on a door has a code of five different digits. Can you use the six clues below to determine the correct code to get in?
%
% 1. There are no zeroes in the five-digit code.
% 2. The first digit is smaller than the second digit.
% 3. Exactly two of the five digits are odd.
% 4. The middile digit is a perfect square.
% 5. The two-digit number formed by the fourth and fifth digits is a perfect square.
% 6. The two-digit number formed by the third and fourth digits is equal to the first digit multiplied by ythe second digit.
is_digit(1).
is_digit(2).
@forestbelton
forestbelton / awk.sh
Last active April 13, 2020 09:44
helpful awk aliases
function awkn {
local ARGS=""
local FLAG=""
local N="$1"
shift
while getopts "F:v:" FLAG; do
case "$FLAG" in
F) ARGS="$ARGS -F$OPTARG" ;;
@forestbelton
forestbelton / star-levels.html
Last active February 8, 2023 11:51
Shrine of the Spirits: Star levels
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Shrine of the Spirits: Star levels</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
<style>
@forestbelton
forestbelton / doc.md
Last active June 27, 2026 18:17
Classical vs Rational trigonometry

Problem

Find the length $d$ in

Figure of a triangle

Classical solution

Let the angles of $A_1$ and $B$ be $\alpha$ and $\beta$ respectively, as shown in the Figure 1.6. The law of cosines in the triangle $\overline{A_1 A_2 A_3}$ gives

$$4^2 = 5^2 + 6^2 - 2 \times 5 \times 6 \times \cos{\alpha}$$