This file contains 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
#!/usr/bin/env ruby | |
# klg, Dec 2019 | |
require 'MeCab' | |
require 'erb' | |
def to_hira(str) | |
str.gsub(/[ァ-ヴヽヾ]/) do |x| | |
(x.ord - 96).chr x.encoding | |
end | |
end |
This file contains 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
#!/usr/bin/env perl | |
# Convert a vector or matrix of floating point numbers to a CDR format | |
# which can be relatively quickly loaded and decoded by GNU APL with 12⎕CR. | |
# klg, Aug 2019 | |
use strict; | |
use warnings; | |
use constant CDR_FLT64 => 2; | |
my @shape = (0, 0); |
This file contains 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
#!/usr/bin/env ruby | |
# Like <https://gist.github.com/jimfoltz/ee791c1bdd30ce137bc23cce826096da> | |
# but cooler. Keep only 10 last revisions, gzipped. | |
# klg, Jun 2019 | |
require 'securerandom' | |
require 'webrick' | |
require 'zlib' | |
class Tw5 < WEBrick::HTTPServlet::AbstractServlet |
This file contains 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
#! /usr/bin/env gosh | |
; klg, May 2019 !# | |
(define (filter pred lst) ; or just (use srfi-1) | |
(let loop ((lst lst)) | |
(cond | |
((null? lst) lst) | |
((pred (car lst)) | |
(cons (car lst) (loop (cdr lst)))) | |
(else (loop (cdr lst)))))) |
This file contains 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
/* | |
SeekGzip <https://github.com/chokkan/seekgzip/> provides a convenient | |
API wrapping Mark Adler's example code for random access to GZIP files | |
and defines simple format to store the index. However, it directly | |
calls Adler's extract function for every read, which is very slow | |
when reading contiguous sequence as it restarts reading from last | |
seek point every time, processing same data over and over. | |
This is a drop-in replacement for the reading part of SeekGzip | |
implementation that keeps whole state around and uses the index |
This file contains 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
.scroll-styled-h, .scroll-styled-v { | |
scrollbar-width: thin; | |
scrollbar-color: #e1e8ed #f5f8fa; | |
} | |
html.dark .scroll-styled-h, html.dark .scroll-styled-v { | |
scrollbar-color: #3d5466 #38444d; | |
} |
This file contains 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
;; (match-let ((pattern values) ...) body) | |
(macro (match-let form) | |
(letrec | |
((match (lambda (var val) | |
(cond | |
((symbol? var) | |
`((,var ,val))) | |
((pair? var) | |
`(,@(match (car var) `(car ,val)) | |
,@(match (cdr var) `(cdr ,val)))) |
This file contains 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
STARTFONT 2.1 | |
COMMENT Miscellaneous full-width glyphs; klg, Apr 2019 | |
COMMENT Based on K14, public domain | |
COMMENT (uni672C is used by rxvt-unicode for width detection) | |
FONT -klg-TC14-Medium-R-Normal-fwmisc-14-140-72-72-C-140-ISO10646-1 | |
SIZE 14 72 72 | |
FONTBOUNDINGBOX 14 14 0 -2 | |
STARTPROPERTIES 16 | |
FOUNDRY "klg" | |
FAMILY_NAME "TC14" |
This file contains 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
--- /usr/share/i18n/locales/ja_JP 2019-02-28 06:56:01.000000000 +0100 | |
+++ ja_JP 2019-04-01 10:42:00.465981000 +0200 | |
@@ -14946,7 +14946,9 @@ | |
t_fmt_ampm "%p%I<U6642>%M<U5206>%S<U79D2>" | |
-era "+:2:1990//01//01:+*:<U5E73><U6210>:%EC%Ey<U5E74>";/ | |
+era "+:2:2020//01//01:+*:<U4EE4><U548C>:%EC%Ey<U5E74>";/ | |
+ "+:1:2019//05//01:2019//12//31:<U4EE4><U548C>:%EC<U5143><U5E74>";/ | |
+ "+:2:1990//01//01:2019//04//30:<U5E73><U6210>:%EC%Ey<U5E74>";/ |
This file contains 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
#!/usr/bin/env perl | |
# Visual hex dump using CP437-like graphics. | |
# Only few fonts can handle that, but it's better than |........|. | |
# klg, Jul 2015; Jan 2018 | |
use strict; | |
use utf8; | |
use open ':std', ( | |
IN => ':bytes', | |
OUT => ':locale' | |
); |