Skip to content

Instantly share code, notes, and snippets.

View tani's full-sized avatar
:octocat:
LISP interpreter

TANIGUCHI Masaya tani

:octocat:
LISP interpreter
View GitHub Profile
// Copyright (c) Masaya Taniguchi.
// This software is licensed under the Public Domain.
//
// Isabelle overrides the existing keybindings.
// This script prevents this behaviour with some properties.
//
// Usage
// $ deno run -A ./override.ts Emacs_keys.props imported_keys.props >> ../properties
import { readLines } from "https://deno.land/std@0.192.0/io/mod.ts"
// ==UserScript==
// @name Show Weekly Diff / esa.io
// @namespace io.github.tani
// @match https://*.esa.io/posts/*
// @grant none
// @version 1.0
// @author Masaya Taniguchi
// @description 2023/5/11 18:40:31
// @require https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js
// ==/UserScript==
import pandoc from "https://cdn.jsdelivr.net/gh/tani/deno-pandoc/out/mod.js";
import * as MediaType from "https://deno.land/x/media_types@v2.3.7/mod.ts";
import * as Eta from "https://deno.land/x/eta@v1.12.3/mod.ts";
import * as Yaml from "https://deno.land/std@0.114.0/encoding/yaml.ts";
import { serve } from "https://deno.land/std@0.114.0/http/server.ts";
const { pathname: dirname } = new URL('.', import.meta.url)
async function handleRequest(request: Request): Promise<Response> {
const { pathname } = new URL(request.url)
@tani
tani / CleanClipboard.ahk
Created January 31, 2022 05:39
Copy text without newline by Alt+C
#NoEnv
#Warn
SendMode Input
SetWorkingDir %A_ScriptDir%
!c::
Send,^c
ClipWait
StringReplace,clipboard,clipboard,`r`n, ,All
// Fuzzy matching written by TANIGUCHI Masaya
// Public Domain
function findAllMatches(pattern: string, source:string) {
const indicesList: number[][] = pattern.split("").map(char => {
return ([] as number[]).concat(
...source.split("").map((c, i) => c === char ? [i] : [])
)
})
function recur(acc: number[], i: number): number[][] {
lualatex('-shell-escape -synctex=1 -interaction=nonstopmode -halt-on-error');
$aux_dir = 'build';
$out_dir = 'build';
$makeindex = 'upmemdex';
$bibtex = 'upbibtex';
$biber = 'biber --bblencoding=utf8 -u -U --output_safechars';
sub pdflatex {
$pdf_mode = 1;
@tani
tani / spack.lisp
Last active July 4, 2021 15:04
SPACK is a toy package system for LISP.
;;
;; # SPACK
;;
;; SPACK is a toy package system for LISP.
;;
;; ## Syntax
;;
;; Predefined functions and variables are unprefixed.
;; User-defined functions and variables are prefixed by package
;; declared by `spack/defpackage'. There is a separator `/' between
#lang racket
(require srfi/1)
(define (walk-bfs-n node)
;; ((walk-bfs-n '(a (b c d) e)) list)
(lambda (k)
(if (list? node)
(let* ((label (first node))
(nodes (rest node))
(labels (map (lambda (node) (call/cc (walk-bfs-n node))) nodes)))
@tani
tani / Dockerfile
Last active October 29, 2020 03:00
cl-lsp
FROM debian:10
WORKDIR /work
ENV LANG=C.UTF-8
#
# Install dependencies
#
RUN apt-get update \
&& apt-get upgrade -y \
@tani
tani / maze.cpp
Last active October 19, 2020 05:00
// clang++ -std=c++17 -lncurses -o maze maze.cpp
#include<array>
#include<cstdio>
#include<cstdint>
#include<ctime>
#include<cstdlib>
#include<ncurses.h>
enum State {