This file contains 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 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 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 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 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 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]")))) |
This file contains 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 ray-tracer | |
(:import java.util.List | |
java.awt.Color | |
java.awt.image.BufferedImage | |
javax.imageio.ImageIO | |
java.io.File)) | |
(alter-var-root #'*compiler-options* (constantly {:direct-linking true}) ) | |
(set! *unchecked-math* :warn-on-boxed) |
This file contains 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 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
# A fatal error has been detected by the Java Runtime Environment: | |
# | |
# SIGSEGV (0xb) at pc=0x00007f65b7f497c7, pid=1, tid=0x00007f61ec4e9700 | |
# | |
# JRE version: OpenJDK Runtime Environment (8.0) (build 1.8.0-builds.shipilev.net-openjdk-shenandoah-jdk8-b450-20191030-aarch64-shenandoah-jdk8u232-b09) | |
# Java VM: OpenJDK 64-Bit Server VM (25.71-b450-20191030-aarch64-shenandoah-jdk8u232-09 mixed mode linux-amd64 compressed oops) | |
# Problematic frame: | |
# V [libjvm.so+0x8b97c7] ObjectMonitor::enter(Thread*)+0x6d7 | |
# | |
# Core dump written. Default location: /app/core or core.1 |
This file contains 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
// ==UserScript== | |
// @name Twitter hide garbage | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @match https://twitter.com/* | |
// @grant GM_addStyle | |
// ==/UserScript== | |
(function() { | |
'use strict'; |
NewerOlder