Ah indeed, ALT+S does nothing. I must have pressed both before realizing it was frozen.
- 3 Posts
- 30 Comments
On my Terminal that just makes it so I can’t type anymore, I feel like I’m doing something wrong…
My solution to the problem is CTRL+U, type sudo, CTRL+Y.
If you’re a fan of Windows 7 I can highly recommend aerothemeplasma for the full experience!
eco_game@discuss.tchncs.deto
Selfhosted@lemmy.world•Watchtower replacement recommendationsEnglish
21·3 months agoI don’t use it anymore as I switched to TrueNAS which has the functionality built in, but I used to use docking-station.
eco_game@discuss.tchncs.deto
Technology@lemmy.ml•Discord will require a face scan or ID for full access next month
142·4 months agoUsers who aren’t verified as adults will not be able to access age-restricted servers and channels, won’t be able to speak in Discord’s livestream-like “stage” channels, and will see content filters for any content Discord detects as graphic or sensitive. They will also get warning prompts for friend requests from potentially unfamiliar users, and DMs from unfamiliar users will be automatically filtered into a separate inbox.
That shouldn’t be too restricting for people using discord to chat with their friends though.
I don’t know, I always found it pretty fun on my Xbox 360.
eco_game@discuss.tchncs.deto
Programming@programming.dev•We Mass-Deployed 15-Year-Old Screen Sharing Technology and It's Actually Better
101·6 months agoFrom what I read, the modern solution has smooth 60 fps, compared to 2-10 FPS with the JPEG method. Granted, that probably also factors in low network speeds, but I’d imagine you may hit a framerate cap lower than 60 when just spamming JPEGs.
eco_game@discuss.tchncs.deto
Advent Of Code@programming.dev•🤶 - 2025 DAY 8 SOLUTIONS - 🤶
2·6 months agoOh wow, I see you went the Kotlin way of hacking together an object with Pairs and Triples. I used to do that too but then it got too confusing lol
eco_game@discuss.tchncs.deOPto
Advent Of Code@programming.dev•[2025 Day 8] Fan go brrrrr
1·6 months agoYou’re right, iterating through the pairs does seem to be the way. After doing some analyzing of what takes how long, it seems my issue is with (quickly) figuring out whether I’ve already connected all nodes or not.
eco_game@discuss.tchncs.deto
Advent Of Code@programming.dev•🤶 - 2025 DAY 8 SOLUTIONS - 🤶
3·6 months agoMy algorithm is probably pretty horrible, I was purely out to get a solution as fast as possible. I might try improving it after Day12…
eco_game@discuss.tchncs.deto
Advent Of Code@programming.dev•🤶 - 2025 DAY 8 SOLUTIONS - 🤶
4·6 months agoKotlin
First tricky puzzle today, instantly leading me to more or less brute force for part2. I took a lot of time to understand which data structures I needed today, and how to compute my matrix.
Runtimes:
part1: 141ms
part2: 45.9 seconds .-.Solution
class Day08 : Puzzle { lateinit var boxes: List<Point3D> lateinit var edges: List<Pair<List<Point3D>, Double>> override fun readFile() { val input = readInputFromFile(2025, 8, false) boxes = input.lines().filter { it.isNotBlank() } .map { it.split(",") } .map { Point3D(it[0].toInt(), it[1].toInt(), it[2].toInt()) } edges = calculateEdges(boxes) } private fun calculateEdges(boxes: List<Point3D>): List<Pair<List<Point3D>, Double>> { val edges = mutableListOf<Pair<MutableList<Point3D>, Double>>() for (i in boxes.indices) { for (j in i + 1 until boxes.size) { edges.add(Pair(mutableListOf(boxes[i], boxes[j]), boxes[i].dist(boxes[j]))) } } return edges.sortedBy { it.second } } override fun solvePartOne(): String { val connections = buildEmptyConnectionMatrix(boxes.size) val mutableEdges = edges.toMutableList() for (i in 0..<1000) { connectNextEdge(mutableEdges, connections) } val connectionSet = buildConnectionSet(boxes, connections) return connectionSet.map { it.size } .sortedByDescending { it } .take(3) .reduce(Int::times) .toString() } override fun solvePartTwo(): String { val connections = buildEmptyConnectionMatrix(boxes.size) val mutableEdges = edges.toMutableList() var result: Long? = null while (result == null) { result = connectNextEdge(mutableEdges, connections, true) } return result.toString() } // size: width & height of (square) matrix private fun buildEmptyConnectionMatrix(size: Int): Array<Array<Boolean>> { val connections = Array(size) { Array(size) { false } } for (i in connections.indices) { connections[i][i] = true } return connections } private fun connectNextEdge(mutableEdges: MutableList<Pair<List<Point3D>, Double>>, connections: Array<Array<Boolean>>, part2: Boolean = false): Long? { if (mutableEdges.isEmpty()) return null val next = mutableEdges[0] val point = next.first[0] val other = next.first[1] connectAll(boxes.indexOf(point), boxes.indexOf(other), connections) mutableEdges.remove(next) // all nodes are connected, assume that this is happening for the first time return if (part2 && connections[0].all { it }) { next.first[0].x.toLong() * next.first[1].x.toLong() } else { null } } private fun connectAll(index: Int, other: Int, connections: Array<Array<Boolean>>) { fun connectHelper(hIndex: Int) { val newConnections = mutableSetOf<Int>() for (i in connections[hIndex].indices) { if (connections[hIndex][i]) newConnections.add(i) } for (boxIndex in newConnections.filter { it != hIndex }) { for (conn in newConnections.filter { it != boxIndex }) { connections[boxIndex][conn] = true } } } connections[index][other] = true connectHelper(index) // update matrix with all values from node at [index] connectHelper(other) // update matrix with all values from node at [other] } // returns 2D-list of all indices of currently active connections private fun buildConnectionSet(boxes: List<Point3D>, connections: Array<Array<Boolean>>): Set<List<Int>> { val connectionSet = mutableSetOf<List<Int>>() val indices = (0 until boxes.size).toMutableList() while (indices.isNotEmpty()) { val list = mutableListOf<Int>() val curr = indices.removeFirst() val array = connections[curr] for (j in array.indices) { if (array[j]) list.add(j) } connectionSet.add(list) } return connectionSet } data class Point3D(val x: Int, val y: Int, val z: Int) { fun dist(other: Point3D): Double { return sqrt( (x - other.x).toDouble().pow(2) + (y - other.y).toDouble().pow(2) + (z - other.z).toDouble().pow(2) ) } } }full code on Codeberg
eco_game@discuss.tchncs.deOPto
Advent Of Code@programming.dev•[2025 Day 7] As long as the result is positive, it can't have overflown, right?
3·6 months agoI usually use Longs by default too, but this year I mostly got by with Ints, so I’ve stuck to Ints for less memory (my solutions tend to be rather inefficient in that regard .-.)
eco_game@discuss.tchncs.deto
Advent Of Code@programming.dev•👪 - 2025 DAY 7 SOLUTIONS - 👪
3·6 months agoKotlin
Tried recursive for part1, didn’t work. LUCKILY for once I was smart and committed anyway, as it was the right solution for part2! I was losing my mind for a bit though as I had originally written my method with Integers…
Solution
class Day07 : Puzzle { val grid = mutableListOf<MutableList<Char>>() val partTwoCache = mutableMapOf<Pair<Int, Int>, Long>() override fun readFile() { val input = readInputFromFile(2025, 7, false) for (line in input.lines().filter { it.isNotBlank() }) { grid.add(line.toCharArray().toMutableList()) } } override fun solvePartOne(): String { grid[1][grid[0].indexOf('S')] = '|' var splits = 0 for (r in 1..<grid.size - 1) { for (c in 0..<grid[r].size) { if (grid[r][c] == '|') { if (grid[r+1][c] == '.') { grid[r+1][c] = '|' } else if (grid[r+1][c] == '^') { grid[r+1][c-1] = '|' grid[r+1][c+1] = '|' splits++ } } } } return splits.toString() } override fun solvePartTwo(): String { val start = grid[0].indexOf('S') return (1 + processBeamPartTwo(1, start)).toString() // don't forget to count the original timeline } private fun processBeamPartTwo(row: Int, column: Int): Long { if (partTwoCache.contains(Pair(row, column))) { return partTwoCache[Pair(row, column)]!! } if (row == grid.size) return 0L if (column == grid[row].size || column < 0) return 0L val out = if (grid[row][column] == '^') { // splitter 1L + processBeamPartTwo(row, column - 1) + processBeamPartTwo(row, column + 1) } else { processBeamPartTwo(row + 1, column) } partTwoCache[Pair(row, column)] = out return out } }full code on Codeberg
eco_game@discuss.tchncs.deto
Advent Of Code@programming.dev•💃 - 2025 DAY 6 SOLUTIONS - 💃
3·6 months agoKotlin
I’m not fully happy with my parsing today, but oh well. I also thought about just plain building the grid and then rotating it, but “normal input parsing” works too.
Solution
class Day06 : Puzzle { val numsPartOne = mutableListOf<MutableList<Long>>() val numsPartTwo = mutableListOf<List<Long>>() val ops = mutableListOf<(Long, Long) -> Long>() override fun readFile() { val input = readInputFromFile("src/main/resources/a2025/day06.txt") val lines = input.lines().filter { it.isNotBlank() } // parse part1 input for (line in lines.dropLast(1)) { for ((c, num) in line.trim().split(" +".toRegex()).withIndex()) { if (numsPartOne.getOrNull(c) == null) numsPartOne.add(mutableListOf()) numsPartOne[c].add(num.toLong()) } } // parse part2 input var numList = mutableListOf<Long>() for (c in 0..<lines.maxOf { it.length }) { var numStr = "" for (r in 0..<lines.size - 1) { numStr += lines[r].getOrElse(c) { ' ' } } if (numStr.isBlank()) { numsPartTwo.add(numList) numList = mutableListOf() } else { numList.add(numStr.trim().toLong()) } } numsPartTwo.add(numList) // parse operators ops.addAll( lines.last().split(" +".toRegex()) .map { it.trim()[0] } .map { when (it) { '*' -> { a: Long, b: Long -> a * b } '+' -> { a: Long, b: Long -> a + b } else -> throw IllegalArgumentException("Unknown operator: $it") } } ) } override fun solvePartOne(): String { return numsPartOne.mapIndexed { c, list -> list.reduce { a, b -> ops[c](a, b) } }.sum().toString() } override fun solvePartTwo(): String { return numsPartTwo.mapIndexed { c, list -> list.reduce { a, b -> ops[c](a, b) } }.sum().toString() } }full code on Codeberg
eco_game@discuss.tchncs.deto
Advent Of Code@programming.dev•🎄 - 2025 DAY 5 SOLUTIONS - 🎄
2·6 months agoKotlin
I first solved the puzzle with my own horrible range-merging algorithm, had quite a few nasty off by one errors. I quickly replaced it with the “normal” merge-algorithm after getting the right solution.
If you really want to see my abomination, it’s still in the commits on my repo.
Solution
class Day05 : Puzzle { val validIds = mutableSetOf<LongRange>() val ids = mutableListOf<Long>() override fun readFile() { val input = readInputFromFile("src/main/resources/a2025/day05.txt") val inputList = input.split("\n\n", limit = 2) validIds.addAll( inputList[0].lines().filter { it.isNotBlank() } .map { it.split("-").map { it.toLong() } } .map { LongRange(it[0], it[1]) } ) ids.addAll(inputList[1].lines().filter { it.isNotBlank() }.map { it.toLong() }) } override fun solvePartOne(): String { return ids.count { id -> validIds.any { id in it } }.toString() } override fun solvePartTwo(): String { val idsSorted = validIds.sortedBy { it.first } val merged = mutableSetOf<LongRange>() var current = idsSorted.first() for (i in 1..<idsSorted.size) { val next = idsSorted[i] if (next.first <= current.last) { current = LongRange(current.first, max(current.last, next.last())) } else { merged.add(current) current = next } } merged.add(current) return merged.sumOf { it.last + 1 - it.first }.toString() } }full code on Codeberg
eco_game@discuss.tchncs.deto
Advent Of Code@programming.dev•🎄 - 2025 DAY 4 SOLUTIONS - 🎄
3·7 months agoKotlin
Pretty simple solution, just plain count / remove the rolls until none can be removed anymore. I would’ve liked to try using imaginary numbers this year (due to this article), but sadly Kotlin doesn’t natively support them and I was too lazy to use a library.
Solution
class Day04 : Puzzle { val grid = mutableListOf<MutableList<Char>>() override fun readFile() { val input = readInputFromFile("src/main/resources/a2025/day04.txt") for ((r, line) in input.lines().filter(String::isNotBlank).withIndex()) { grid.add(mutableListOf()) for (char in line) { grid[r].add(char) } } } override fun solvePartOne(): String { return countRolls(grid).toString() } override fun solvePartTwo(): String { var sum = 0 var removed = -1 while (removed != 0) { // main grid is modified here, not the best but doesn't really matter // also no idea how to clone 2D list in Kotlin removed = countRolls(grid, true) sum += removed } return sum.toString() } private fun countRolls(grid: MutableList<MutableList<Char>>, removeRolls: Boolean = false): Int { val dr = listOf(-1, -1, -1, 0, 0, 1, 1, 1) val dc = listOf(-1, 0, 1, -1, 1, -1, 0, 1) var sum = 0 for (r in grid.indices) { for (c in grid[r].indices) { if (grid[r][c] != '@') continue var neighborCount = 0 for (i in dr.indices) { if (gridGet(grid, r + dr[i], c + dc[i]) == '@') neighborCount++ } if (neighborCount < 4) { sum++ if (removeRolls) grid[r][c] = '.' } } } return sum } private fun gridGet(grid: List<List<Char>>, r: Int, c: Int, default: Char = '.'): Char { return if (r in grid.indices && c in grid[r].indices) { grid[r][c] } else { default } } }full code on Codeberg
eco_game@discuss.tchncs.deto
Advent Of Code@programming.dev•💃 - 2025 DAY 3 SOLUTIONS - 💃
2·7 months agoYeah, I vaguely remember reading something about how close string splitting is to all the logarithm math in splitting numbers, and since then I’ve just always used strings because that’s way more intuitive to me lol
eco_game@discuss.tchncs.deto
Advent Of Code@programming.dev•💃 - 2025 DAY 3 SOLUTIONS - 💃
2·7 months agoNice! I thought about using numbers but then decided that strings are a lot easier to deal with.
eco_game@discuss.tchncs.deto
Advent Of Code@programming.dev•💃 - 2025 DAY 3 SOLUTIONS - 💃
4·7 months agoKotlin
First day this year where I am very happy with my solution. Just super simple, recursive string building.
Solution
class Day03 : Puzzle { val banks = mutableListOf<String>() override fun readFile() { val input = readInputFromFile("src/main/resources/a2025/day03.txt") banks.addAll(input.lines().filter(String::isNotBlank)) } override fun solvePartOne(): String { val sum = banks.map { buildNumber(it, 2) }.sumOf { it.toLong() } return sum.toString() } override fun solvePartTwo(): String { val sum = banks.map { buildNumber(it, 12) }.sumOf { it.toLong() } return sum.toString() } private fun buildNumber(bank: String, remainingDigits: Int): String { if (remainingDigits <= 0) return "" val current = bank.dropLast(remainingDigits - 1) val max = current.max() return max + buildNumber(bank.split(max, limit = 2)[1], remainingDigits - 1) } }full code on Codeberg


Interesting, why is that? Like what feature is that?