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
open System | |
open System.Text.RegularExpressions | |
let input = System.IO.File.ReadAllLines("input/2024/03.txt") |> String.concat String.Empty | |
Regex.Matches(input, "mul\((\d{1,3}),(\d{1,3})\)") | |
|> Seq.map (fun m -> Int32.Parse m.Groups[1].Value * | |
Int32.Parse m.Groups[2].Value) | |
|> Seq.sum | |
|> printfn "%d" |
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
(* Enquoten: An F# Script | |
Summary: Reads a single text file and splits its lines to the maximum line length | |
limit provided. The prefix is included in the line length calculation, and it | |
must be shorter then the line length limit. The script will try to split lines | |
at spaces, but if none are found, it will cut the line at the line length limit. | |
Requirements: .NET 8 runtime (Untested on previous versions, though it might work) | |
Usage: dotnet fsi <lineLengthLimit> <quotePrefix> <filePath> |
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
SUPPORTED_EXTS = ['mp3', 'm4a', 'ogg'] | |
source_ext = ARGV[0] | |
target_ext = ARGV[1] | |
def variables_invalid?(source_ext, target_ext, supported_exts) | |
source_ext.nil? || | |
target_ext.nil? || | |
!supported_exts.include?(source_ext) || | |
!supported_exts.include?(target_ext) |
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
/* TODO: Make formatting less likely to be influenced by the current web page. */ | |
javascript: (() => { | |
let div = document.createElement("div"); | |
div.style.cssText = ` | |
display: block !important; | |
position: fixed !important; | |
background: white !important; | |
color: black !important; | |
font-size: 1.2em !important; | |
text-align: left !important; |