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
| [...document.querySelectorAll('#compTblList > tbody > tr > td:nth-child(12)')].forEach(e => { | |
| const match = e.textContent.match(/([\d.]+)x([\d.]+)x([\d.]+)mm/); | |
| if (!match) return; | |
| const [_, w, h, d] = match; | |
| const liter = +w * +h * +d / 100_0000.0; | |
| const literElem = document.createElement('span'); | |
| literElem.textContent = `(${liter.toFixed(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
| const assert = (pred) => { if (! pred) throw new Error("Assertion failed"); }; | |
| class Connection { | |
| constructor(prevs, next) { | |
| if (prevs.length != next.weights.length) { | |
| throw new RangeError("prevs length should be equal to next weights length"); | |
| } | |
| if (! prevs.map(p => p.weights.length).reduce((x, y) => x && x == y ? x : false)) { | |
| throw new RangeError("all perceptron in prevs should have same weights length"); |
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/sh | |
| # Usage: slack MESSAGE | |
| SLACK_WEBHOOK_URL="" | |
| ( [ -n "$1" ] && echo "$1" || cat ) | | |
| jq -Rn '{ "text": input }' | | |
| curl -d '@-' "$SLACK_WEBHOOK_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
| #include <cassert> | |
| #include <iostream> | |
| #include <type_traits> | |
| #include <optional> | |
| /** | |
| * 篩 | |
| */ | |
| template <typename T> | |
| class Refinement { |
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
| #川渡り問題 | |
| Entity = Struct.new(:id, :eats) do | |
| def eat?(other) | |
| other.id == eats | |
| end | |
| def inspect | |
| "<E:#{id}>" | |
| end |
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
| javascript:(function(){ | |
| const timer_min = +prompt('何分?'); | |
| const timer_ms = timer_min*60*1000; | |
| const endTime = new Date(Date.now() + timer_ms); | |
| setInterval(() => { | |
| const TIMER_ID = 'tdFljaRoMfOGDAb7MMpCtmxElVGIyiHH'; | |
| const now = new Date(); | |
| const rest = endTime - now; |
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
| STORY = 24; | |
| result = [...document.querySelectorAll('.ytd-thumbnail-overlay-time-status-renderer')].map(e => e.textContent.replace(/\s*/g,"")).map(e => e.split(":").reverse().map((e, i) => +e * 60**i).reduce((l,r) => l+r)).reduce((l,r) => l+r) | |
| sec = parseInt(result % 60); | |
| min = parseInt(result % 3600 / 60); | |
| hour = parseInt(result / 3600); | |
| stories = Math.ceil(result / (STORY*60)); | |
| alert(`全部で: ${hour}:${(""+min).padStart(2,0)}:${(""+sec).padStart(2,0)} | |
| 1話${STORY}分とすると: ${stories}話分 | |
| 1クール12話とすると: ${stories/12}クール分`); |
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
| use std::iter::Peekable; | |
| fn varint<'a, I: Iterator<Item=&'a u8>>(peekable: &mut Peekable<I>) -> Option<u64> { | |
| if let Some(msb) = peekable.next() { | |
| let length = { | |
| let bits = (msb & 0b1100_0000) >> 6; | |
| ((bits & 1) + 1) << (bits & 2) | |
| }; | |
| let mut result: u64 = (msb & 0b0011_1111) as u64; |
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/sh | |
| # 保存する間隔(秒数) | |
| INTERVAL_SECONDS="180" | |
| set -xem | |
| azpainter & | |
| pid="${!}" |
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 <cstdint> | |
| #include <cassert> | |
| #include <iostream> | |
| template<typename Self> | |
| class Comparable { | |
| public: | |
| virtual auto compare(Self rhs) const -> int64_t = 0; | |
| virtual auto operator<(Self rhs) const -> bool { |