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
| # Assembler code | |
| # 0x1000 cnt | |
| define cnt 0x1000 | |
| define cnt2 0x1001 | |
| define ptr 0x1002 | |
| # 0x4000+20*0x20+8 | |
| define pos_start 0x4288 | |
| define inc2 0x20 | |
| define inc3 0x1f |
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
| const jscad = require('@jscad/modeling') | |
| const { polyhedron } = jscad.primitives | |
| const { translate } = jscad.transforms | |
| // red -> x, green -> y, blue -> z | |
| const points = [ // [ x, y, z ] | |
| [ 0, 0, 0], [0, 5, 0], [10, 0, 0], | |
| [ 0, 0, 10], |
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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <termios.h> | |
| #include <unistd.h> | |
| #include <string.h> | |
| /* | |
| claude haiku 4.5 prompt: | |
| make me C program with do: |
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
| // part 1 | |
| // example: | |
| // input = [...document.getElementsByTagName('code')].map((e) => e.innerText)[5]; | |
| input = getInput(); | |
| rules = new Set(input.split("\n\n")[0].splitNL()); | |
| list1 = input.split("\n\n")[1].splitNL().splitCOL(","); | |
| list1.filter((row) => { | |
| return row.comb2().map(([a, b]) => rules.has(b + "|" + a) ? 1 : 0).sum() == 0; | |
| }).map((row) => row[Math.floor(row.length / 2)]).nums().sum(); |
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
| // part 1 | |
| function isSafe(row) { | |
| if (row.isIncrease() || row.isDecrease()) { | |
| return row.diff2().abs().filter((a) => (a > 3)).length == 0; | |
| } else { | |
| return 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
| // part 1 | |
| list1 = getInput().splitNL().splitCOL().nums().column(0).toSortedNUM(); | |
| list2 = getInput().splitNL().splitCOL().nums().column(1).toSortedNUM(); | |
| zip(list1, list2).map(([a1, a2]) => Math.abs(a1-a2)).sum(); | |
| // result 1651298 | |
| // part 2 |
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
| (() => { | |
| var cells = [ ... document.getElementById("queens-grid").querySelectorAll(".queens-cell") ]; | |
| var size = Math.sqrt(cells.length); | |
| var map = cells.map(e => e.className.match(/cell-color-(\d+)/)[1]); | |
| var queens = Array(map.length).fill(0); |
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
| (() => { var s = [ ... document.getElementById("queens-grid").querySelectorAll(".queens-cell") ].map(e => e.className.match(/cell-color-(\d+)/)[1]).map(n => Number.parseInt(n).toString(32)).join(''); return s.match(new RegExp('.{1,' + Math.sqrt(s.length) + '}', 'g')).join('@'); })(); |
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
| const symbol_set = Symbol("set"); | |
| export class ArraySet { | |
| constructor() { | |
| this[symbol_set] = new Set(); | |
| } | |
| get size() { |
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
| import hid | |
| vendor_id = 1386 | |
| product_id = 161 | |
| d = hid.device() | |
| d.open(vendor_id, product_id) | |
| while True: | |
| buf = d.read(7) |
NewerOlder