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
I had a dream. Like there is ahead | |
And endless, empty and the wildest plane. | |
And I stand there, held by iron chain, | |
Under the tall rock made from finest granite | |
And next to me are thousands just like me. | |
The face of everyone is marked by woe and sorrow, | |
And eyes of everyone contain fervor of love. | |
And hands of everyone are chained with snakes of iron, | |
And every shoulder's bent low to the ground, |
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
{:deps {org.clojure/clojure {:mvn/version "1.12.0-alpha3"}} | |
:aliases {:dev {:extra-deps | |
{com.clojure-goes-fast/clj-async-profiler {:mvn/version "1.0.4"} | |
com.clojure-goes-fast/clj-java-decompiler {:mvn/version "0.3.4"} | |
com.clojure-goes-fast/clj-memory-meter {:mvn/version "0.3.0"}} | |
:jvm-opts ["-Djdk.attach.allowAttachSelf" | |
"-XX:+UseG1GC" | |
"-XX:-OmitStackTraceInFastThrow" |
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
-- Module for calculating sunrise/sunset times for a given location | |
-- Based on algorithm by United Stated Naval Observatory, Washington | |
-- Link: http://williams.best.vwh.net/sunrise_sunset_algorithm.htm | |
-- @author Alexander Yakushev | |
-- @license CC0 http://creativecommons.org/about/cc0 | |
-- Module lustrous | |
local lustrous = { | |
update_interval = 600 | |
} |
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 day5 | |
(:require [clojure.java.io :as io])) | |
(def lines (vec (line-seq (io/reader "2023/day5.txt")))) | |
(defn parse [task] | |
(let [seeds (mapv parse-long (re-seq #"\d+" (first lines))) | |
seeds (case task | |
1 seeds | |
2 (->> (partition 2 seeds) |
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
%% Copyright 2020 Alexander Yakushev | |
% | |
% This work may be distributed and/or modified under the | |
% conditions of the LaTeX Project Public License, either version 1.3 | |
% of this license or (at your option) any later version. | |
% The latest version of this license is in | |
% http://www.latex-project.org/lppl.txt | |
% and version 1.3 or later is part of all distributions of LaTeX | |
% version 2005/12/01 or later. | |
% |
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 day12 | |
(:require [clojure.string :as str] | |
[clojure.java.io :as io])) | |
(def lines (line-seq (io/reader "2023/day12.txt"))) | |
(defn parse [task] | |
(for [line lines] | |
(let [[field hints] (str/split line #" ")] | |
(case task |
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 day7 | |
(:require [clojure.string :as str] | |
[clojure.java.io :as io])) | |
(def lines (vec (line-seq (io/reader "day7.txt")))) | |
(defn parse [task] | |
(for [line lines] | |
(let [[hand bid] (str/split line #" " )] | |
[(mapv #(case % |
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 day6 | |
(:require [clojure.string :as str])) | |
(defn parse [task] | |
(->> (line-seq (io/reader "2023/day6.txt")) | |
(map #(map parse-long | |
(re-seq #"\d+" (case task | |
1 % | |
2 (str/replace % #" " ""))))))) |
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 day4 | |
(:require [clojure.set :as set] | |
[clojure.java.io :as io])) | |
(def lines (vec (line-seq (io/reader "2023/day4.txt")))) | |
(defn parse [] | |
(for [line lines] | |
(let [[winning guessed] (str/split line #"\|") | |
[game & winning] (map parse-long (re-seq #"\d+" winning)) |
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
;; Didn't know yet that there is a special syntax to make regexes overlapping. Got angry and wrote this. | |
(require '[clojure.string :as str]) | |
(def digits (->> ["one" "two" "three" "four" "five" "six" "seven" "eight" "nine"] | |
(map-indexed (fn [i w] [w (str (inc i))])) | |
(into {}))) | |
(def rx (re-pattern (str/join "|" (conj (keys digits) "[0-9]")))) | |
(def rx-rev (re-pattern (str/join "|" (conj (map str/reverse (keys digits)) "[0-9]")))) |
NewerOlder