This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns cloud.seltzer1717.aoc.day3b | |
(:require [clojure.set :as set] | |
[clojure.pprint :as pretty]) | |
(:import (java.io BufferedReader FileReader) | |
(java.nio.file Files Paths))) | |
(defn gearProduct | |
"Reducing function, product of gear pairs." | |
[[partNumber1 partNumber2]] | |
(* partNumber1 partNumber2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns cloud.seltzer1717.aoc.day3a | |
(:require [clojure.set :as set] | |
[clojure.pprint :as pretty]) | |
(:import (java.io BufferedReader FileReader) | |
(java.nio.file Files Paths))) | |
(def symbolPattern #"(?<symbol>[^\.\d])") | |
(def partPattern #"(?<part>\d+)") | |
(defn getPartAdjacents |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns cloud.seltzer1717.aoc.day1 | |
(:import (java.io BufferedReader FileReader) | |
(java.util.regex Pattern))) | |
(defn sumOfCalibration1 | |
"Takes calibration document, returns sum of calibration lines." | |
[docPath] | |
(let [firstRegex #"^.*?(?<dgt>\d).*$" ;; reluctant | |
lastRegex #"^.*(?<dgt>\d).*?$" ;; greedy | |
rgxNbr (fn [rgx ln] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Advent of Code 2022 | |
;; Day 11 - https://adventofcode.com/2022/day/11 | |
(ns cloud.seltzer1717.monkey | |
(:import (java.io BufferedReader FileReader))) | |
(def notes-header #"(?m)Monkey (?<monkey>\p{Digit}{1,5}):") | |
(def notes-starting #"\p{Space}{2}Starting items: (?<items>\p{Digit}{1,5}(, \p{Digit}{1,5})*)") | |
(def notes-operation #"\p{Space}{2}Operation: new = old (?<trater>\+|\-|\*|\/) (?<trand>\p{Digit}{1,5}|old)") | |
(def notes-test #"\p{Space}{2}Test: divisible by (?<diviser>\p{Digit}{1,5})") | |
(def test-true #"\p{Space}{4}If true: throw to monkey (?<truemonkey>\p{Digit}{1,5})") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn shift | |
"Takes digit char, returns int offset from zero." | |
[nbr] | |
(- (int nbr) (int \0))) | |
(defn next-pair | |
"Reducing fn, takes acc, the destructured pair [chr nbr] | |
and returns next acc." | |
[acc [chr nbr]] | |
(conj acc chr (if nbr (char (+ (int chr) (shift nbr)))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns cloud.seltzer1717.s3.apartment-test | |
(:require [clojure.test :as test] | |
[cloud.seltzer1717.s3.apartment :as apt])) | |
(test/with-test | |
(def sample-blocks | |
[{:gym false :school true :store false} | |
{:gym true :school false :store false} | |
{:gym true :school true :store false} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns cloud.seltzer1717.island) | |
(defn border-fn | |
[sample] | |
(let [rows (count sample) | |
cols (count (first sample))] | |
(fn [[row col]] | |
(or (= 0 row) | |
(= 0 col) | |
(= (dec rows) row) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Directions: | |
;; | |
;; mvn clean install | |
;; ... | |
;; run javap | |
;; rem All classes created with compile call | |
;; rem cloud.seltzer1717.core | |
;; rem cloud.seltzer1717.core__init | |
;; rem cloud.seltzer1717.core$_main | |
;; rem cloud.seltzer1717.core$fn__158 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns com.seltzer1717.term.server.parsehtml | |
(:import | |
(java.io FileReader FileWriter BufferedReader BufferedWriter) | |
(javax.swing.text.html HTMLEditorKit HTMLEditorKit$ParserCallback HTML$Tag HTML$UnknownTag HTML$Attribute) | |
(javax.swing.text.html.parser ParserDelegator))) | |
(def new-elements | |
#{"section" "article" "main" "aside" "header" "footer" "nav" "figure" | |
"figcaption" "template" "video" "audio " "track" "source" "embed" | |
"mark" "progress" "meter" "time" "ruby" "rt" "rp" "bdi" "wbr" "canvas" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Example use of Java annotations in Clojure. | |
;; | |
;; The example uses javax.jws package to build a simle web service. | |
;; | |
;; Make sure you have Clojure and Java. | |
;; This example uses Clojure 1.8.0 and JDK8. | |
;; | |
;; Create the following folder structure: | |
;; | |
;; | webCalculator |
NewerOlder