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) |
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
# [email protected] | |
# 2024-05-05 | |
from evdev import UInput, AbsInfo, ecodes as e | |
import hid | |
tablet_vendor_id = 1386 | |
tablet_product_id = 161 |
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
#!/bin/bash | |
# wordfence appimage builder | |
# by [email protected] | |
APPTOOL_URL="https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage" | |
PY_URL="https://github.com/niess/python-appimage/releases/download/python3.12/python3.12.3-cp312-cp312-manylinux_2_28_x86_64.AppImage" | |
APPTOOL_NAME="$(basename "$APPTOOL_URL")" | |
PY_NAME="$(basename "$PY_URL")" |
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
#!/bin/bash | |
# | |
# depending: bash 4+, socat | |
# | |
# | |
# Copyright (C) 2023 Zeljko Stevanovic <[email protected]> | |
# | |
# This program is free software; you can redistribute it and/or modify |
NewerOlder