Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kotet's full-sized avatar

Kotet kotet

View GitHub Profile
@kotet
kotet / format-man7.js
Created February 16, 2023 07:34
機械翻訳にかけやすいように man7.org から余分な改行を取り除くブックマークレット
javascript: [...document.querySelectorAll("pre")].map(p => {p.innerHTML = "<p>" + p.innerHTML.replace(/\n\s*\n/g,"</p><p>").replace(/\n\s*/g," ")})
@kotet
kotet / 2023solver.d
Created January 5, 2023 12:26
2023パズルのソルバー(最適化版)
// http://nmi.jp/2023-01-03-How-to-solve-2023-puzzle
// https://twitter.com/tkihira/status/1609313732034965506
module solver;
import std;
import std.datetime.stopwatch : StopWatch;
void main()
{
StopWatch sw;
@kotet
kotet / 2023solver.d
Last active January 4, 2023 10:32
2023パズルのソルバー
// http://nmi.jp/2023-01-03-How-to-solve-2023-puzzle
// https://twitter.com/tkihira/status/1609313732034965506
module solver;
import std;
import std.datetime.stopwatch: StopWatch;
void main()
{
StopWatch sw;
@kotet
kotet / LICENSE.md
Created October 26, 2022 04:18
RISC-V privileged ISA 3.1.16 Machine Trap Value Register (mtval) の翻訳
@kotet
kotet / LICENSE.md
Created October 9, 2022 12:52
RISC-V privileged ISA 7 Svinval Standard Extension for Fine-Grained Address-Translation Cache Invalidation, Version 1.0の翻訳
@kotet
kotet / LICENSE.md
Last active September 20, 2022 10:52
RISC-V privileged ISA 3.1.6 Machine Status Registers (mstatus and mstatush) の日本語訳
@kotet
kotet / ddsk.d
Created August 3, 2022 13:31
ドドスコード
import std;
// enum seed = __TIME__.reduce!((a, b) => a * 9 + b);
enum seed = 8;
enum r = Mt19937(seed);
static foreach (s; generate_ddsk_sequence(r))
{
pragma(msg, s);
}
@kotet
kotet / gist:c5771b1d350116702ec02abac8afcd12
Created February 8, 2021 14:05
AtCoderのコンテストトップページで発動するとGoogle Calenderの予定を作って開くブックマークレット
(function(){var a=function(c){return c.getUTCFullYear()+(""+(101+c.getUTCMonth())).slice(1,3)+(""+(100+c.getUTCDate())).slice(1,3)+"T"+(""+(100+c.getUTCHours())).slice(1,3)+(""+(100+c.getUTCMinutes())).slice(1,3)+"00Z"},b=encodeURI,d=document.querySelector("#contest-nav-tabs > div > small.contest-duration"),e=b(a(new Date(d.querySelector("a:nth-child(1) > time").innerText)));a=b(a(new Date(d.querySelector("a:nth-child(2) > time").innerText)));d=b(document.title);var f=b(location.href);b=b(document.querySelector("#main-container > div.row > div:nth-child(2) > p").innerText);window.open("https://www.google.com/calendar/render?action=TEMPLATE&text="+d+"&details="+b+"&location="+f+"&dates="+e+"%2F"+a,"_blank")})();
@kotet
kotet / q.sh
Created January 28, 2021 20:38
コマンドキュー
#!/usr/bin/env bash
# https://betterdev.blog/minimal-safe-bash-script-template/
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [command]
EOF
exit
@kotet
kotet / file-select.sh
Last active October 20, 2020 09:52
ディレクトリをたどってファイルのパスを得るツール
#!/bin/bash
file-select() {
(
cd "${1}"
path=$(ls -a | peco)
path=$(readlink -f "${path}")
if [[ -d "${path}" ]]; then
file-select "${path}"