Skip to content

Instantly share code, notes, and snippets.

@cat2151
cat2151 / arrow_to_latex.pegjs
Last active December 2, 2023 05:52
巨大数の矢印表記を展開してゆき、テトレーションまで展開したあとはLaTeX表記にします
Start = Final
/ Term
Final = head:Integer "^^" tail:Integer {
if (tail >= 9) {
return '$\\underbrace{' + head + '^{' + head + '^{' + head + '^{.^{.^{.^{' + head + '^{' + head + '^{' + head + '}}}}}}}}}_{' + tail + '}$';
} else {
return '$' + (head + '^{').repeat(tail) + '}'.repeat(tail - 1) + String.fromCharCode(0x7D) + '$';
}
}
@cat2151
cat2151 / index.html
Created May 16, 2021 12:36
MML REPL like
<script src="https://minipop.github.io/sionicjs/demo/pico.min.js"></script>
<script src="https://minipop.github.io/sionicjs/dist/sionic.js"></script>
<textarea id="textarea2" rows="5" cols="10">@5 l8 o7 c
d
e</textarea>
<br>
<textarea id="textarea4" rows="1" cols="10">@5 l2 </textarea>
<br>
<textarea id="textarea3" rows="5" cols="10">c;e;g;
c;f;a;</textarea>
@cat2151
cat2151 / index.html
Created May 16, 2021 12:35
MML REPL modoki
<script src="https://minipop.github.io/sionicjs/demo/pico.min.js"></script>
<script src="https://minipop.github.io/sionicjs/dist/sionic.js"></script>
<textarea id="textarea3">c;e;g</textarea>
<input type="button" value="play" onclick="clickBtn5()" />
<script>
let textarea = document.getElementById("textarea3");
textarea.addEventListener("input", clickBtn5);
function clickBtn5() {
const ta3 = document.getElementById("textarea3").value;
@cat2151
cat2151 / decodeCharacterEntityReferences.sed
Created October 7, 2018 06:13
文字実体参照を文字にデコードする
s/&quot;/"/g
s/&amp;/\&/g
s/&apos;/'/g
s/&lt;/</g
s/&gt;/>/g
s/&nbsp;/ /g
s/&iexcl;/¡/g
s/&cent;/¢/g
s/&pound;/£/g
s/&curren;/¤/g
@cat2151
cat2151 / verticalize.bat
Created October 6, 2018 06:37
画像の縦長化:bat+PowerShell+ImageMagickで、カレントdir配下の指定種類の画像に対して、横長画像なら左90度回転し縦長画像にする(サブディレクトリ含む)
@powershell -NoProfile -ExecutionPolicy Unrestricted "$s=[scriptblock]::create((gc \"%~f0\"|?{$_.readcount -gt 1})-join\"`n\");&$s" %*&goto:eof
# 縦長化
# カレントdir配下の指定種類の画像をすべて縦長画像にする(サブディレクトリ含む)
# [危険!] 画像ファイルを上書きします。
# 安全のため、元の画像ファイルが別の場所にバックアップされている状態で実行してください。
param($searchPath = $(pwd))
# 設定
$magick=".\magick.exe" # [前提] magick.exe と magic.xml が指定の場所にあること
$pattern=".*jpg|.*gif" # 変換対象の画像ファイル名(正規表現)
@cat2151
cat2151 / ln-s.bat
Last active May 22, 2019 19:11 — forked from 0x60df/ln-s.bat
Windows bat file for creating symbolic link without cmd(run as administrator).
@echo off
setlocal
set invalidUsage=false
if "%~1"=="" set invalidUsage=true
if "%~2"=="" set invalidUsage=true
if "%invalidUsage%"=="true" (
echo Usage: ln-s TARGET LINK_NAME
exit /b 1
@cat2151
cat2151 / listDir.bat
Last active August 20, 2017 13:28
bat+PowerShellでファイル一覧を取得(ファイルサイズ、タイムスタンプ、フルパス) ref: http://qiita.com/cat2151/items/33bfae662fb120ff7f62
@powershell -NoProfile -ExecutionPolicy Unrestricted "$s=[scriptblock]::create((gc \"%~f0\"|?{$_.readcount -gt 1})-join\"`n\");&$s" %*&goto:eof
#
# ファイル一覧取得
#
# 出力項目
# ファイル名、ファイルサイズ、更新日付、フルパスディレクトリ名 (属性、親ディレクトリ名、拡張子、フルパス も出力可。コメントアウトしてあります)
# 参考
# http://qiita.com/yjnk/items/a69920748e96272bfd10
# 引数
# パターン1
@cat2151
cat2151 / commentOutEclipseLike.js
Last active April 6, 2018 17:22
サクラエディタ用マクロ Eclipse風コメントアウト
/*
* @file commentOutEclipseLike.js
* @brief 選択範囲、もしくはカーソル行をコメントアウト/アンコメントするサクラエディタマクロ
* @author cat2151
*
* phodra氏作成の同様のマクロを改変したもの。
* http://sakura-editor.sourceforge.net/cgi-bin/cyclamen/cyclamen.cgi?log=macro&tree=c591
*
* ・コメントアウト行を選択した場合はアンコメント。そうでない場合はコメントアウト。
* ・クイックハックなのでリファクタリング不足。
@cat2151
cat2151 / helloworld_powershell_jscn.bat
Created July 20, 2017 16:29
batファイル内のPowerShell内のJScript.NET(≒JavaScript)プログラムを動かす
@powershell -NoProfile -ExecutionPolicy Unrestricted "$s=[scriptblock]::create((gc \"%~f0\"|?{$_.readcount -gt 1})-join\"`n\");&$s" %*&goto:eof
# http://qiita.com/cd01/items/82829ba0ec0f59e1b04d
# http://winscript.jp/powershell/221
Param($argBat)
$src = @'
static function helloFunc(arg) {
var msg = "hello " + arg + " world";
@cat2151
cat2151 / helloworld_powershell_js.bat
Last active July 20, 2017 16:50
batファイル内のPowerShell内のJavaScriptプログラムを動かす
@%windir%\SysWOW64\cmd.exe /C powershell -NoProfile -ExecutionPolicy Unrestricted "$s=[scriptblock]::create((gc \"%~f0\"|?{$_.readcount -gt 1})-join\"`n\");&$s" %*&goto:eof
# http://qiita.com/cd01/items/82829ba0ec0f59e1b04d
# http://blog.livedoor.jp/morituri/archives/53997724.html
Param($argBat)
$objjs = New-Object -comobject ScriptControl
$objjs.Language = "Javascript"
$src = @'