Skip to content

Instantly share code, notes, and snippets.

View mdwhatcott's full-sized avatar

Michael Whatcott mdwhatcott

View GitHub Profile
@mdwhatcott
mdwhatcott / spelling_bee.py
Created August 29, 2025 23:12
NYT Spelling Bee Solver
# Official Game: https://www.nytimes.com/puzzles/spelling-bee
# Knockoff Game: https://spellsbee.com/
required = 'k' # The letter in the center of the hexagon.
possible = set(required+"ucoden") # The letters around the center letter.
with open('/usr/share/dict/words') as d:
for line in d:
line = line.strip().lower()
if len(line) < 4:
continue
if required not in line:
@mdwhatcott
mdwhatcott / main.go
Last active August 26, 2025 17:23
steakhouse submission 2025-08-26T15:17:18Z
package main
import (
"fmt"
"os"
"strings"
)
func SearchString(input *os.File) (s string, err error) {
var result strings.Builder
@mdwhatcott
mdwhatcott / 00_correct_but_wasteful.go
Last active August 8, 2025 21:39
Code Samples: Careful Object Pooling and Reuse
package main
import (
"bytes"
"fmt"
"runtime"
)
func main() {
ch := make(chan *bytes.Buffer)
"""
Solution to puzzle with ID C823GV from www.Printable-Puzzles.com
https://logic.puzzlebaron.com/pdf/C823GV.pdf
There are 4 named individuals: Caroline, Donovan, Keaton, and Lucy
There are 4 appointment times: 5:00pm, 5:30pm, 6:00pm, and 6:30pm
There are 4 origin cities: Seattle, Pittsburgh, Warwick, and Wilmington
There are 4 tv channels: CNN, HBO, Showtime, and Cinemax
The clues are as follows:
type Slice struct {
Data []int
Length int
Capacity int
}
func Insert(record *Slice, position int, value int) {
capacity := record.Length + 1
if position > capacity {
capacity = position
@mdwhatcott
mdwhatcott / http_get.go
Created January 17, 2023 22:22
A simple http get example, using the Smarty US Street Address API (but no error handling or deferred functions)
package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
"strings"
)
@mdwhatcott
mdwhatcott / http_get.go
Created January 17, 2023 21:59
A simple http get example, using the Smarty US Street Address API (but everything is in the main function)
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"strings"
)
@mdwhatcott
mdwhatcott / http_get.go
Created January 16, 2023 23:54
A simple http get example, using the Smarty US Street Address API
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"strings"
)
@mdwhatcott
mdwhatcott / mini-smartylist.go
Created January 16, 2023 23:53
A tiny address list processor
package main
import (
"encoding/csv"
"encoding/json"
"io"
"log"
"net/http"
"os"
)
@mdwhatcott
mdwhatcott / stringly.go
Last active January 13, 2023 00:00
Go is stringly typed, right?
package main
import (
"fmt"
"reflect"
)
type (
MyFirstEvent struct{ AccountID uint64 }
MySecondEvent struct{ AccountID uint64 }