Skip to content

Instantly share code, notes, and snippets.

@youz
youz / dice.rb
Last active June 4, 2021 07:33
usage: ruby dice.rb 8 5 | ruby judge.rb | sed -f nko.sed
ndice = $*[0].to_i
rounds = $*[1].to_i
rounds.times {
puts ndice.times.map{(rand(6)+1).to_s}*" "
}
%!
%%BoundingBox: 0 0 540 540
/N 4 def
0 0.4 0.8 setrgbcolor
0.5 setlinewidth
/len 400 3 N exp div def
/k {
@youz
youz / gaming.hlsl
Last active February 19, 2021 03:04
ゲーミングWindowsTerminal
Texture2D shaderTexture;
SamplerState samplerState;
cbuffer PixelShaderSettings {
float Time;
float Scale;
float2 Resolution;
float4 Background;
};
@youz
youz / gaming.hlsl
Last active May 26, 2023 16:18
Windows Terminal 1.6pre ピクセルシェーダ+Rubyスクリプトでアニメーション
Texture2D shaderTexture;
SamplerState samplerState;
cbuffer PixelShaderSettings {
float Time;
float Scale;
float2 Resolution;
float4 Background;
};
@youz
youz / grid.hlsl
Last active May 26, 2023 16:05
shaders for Windows Terminal
Texture2D shaderTexture;
SamplerState samplerState;
cbuffer PixelShaderSettings {
float Time;
float Scale;
float2 Resolution;
float4 Background;
};
@youz
youz / pt2.sql
Last active September 30, 2021 02:23
penrose tiling in SQL
-- requires SQLite ver.3.34.0 or later
-- ref. How to construct Penrose tilings
-- https://tartarus.org/~simon/20110412-penrose/penrose.xhtml
WITH consts AS (
SELECT
8 AS n, -- number of iterations
500 AS l, -- width & height of image
0.7265425280053609 AS tan36, -- tan(π/5)
@youz
youz / pt.sql
Last active October 29, 2020 14:58
Penrose tiling in SQL
-- requires SQLite ver.3.34.0 or later
-- ref. How to construct Penrose tilings
-- https://tartarus.org/~simon/20110412-penrose/penrose.xhtml
WITH consts AS (
SELECT
8 AS n, -- number of iterations
500 AS l, -- width & height of image
0.7265425280053609 AS tan36, -- tan(π/5)
@youz
youz / wsl.l
Last active October 20, 2020 00:48
wsl utility for xyzzy
;;; -*- mode: lisp; package: wsl -*-
(defpackage :wsl
(:use :lisp :editor))
(in-package :wsl)
(export '(run-wsl
run-wsl-in-buffer
convert-wslpath-to-win
@youz
youz / penrose-tiling.pdf
Last active October 14, 2020 03:36
Penrose tiling in SATySFi
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@youz
youz / penrose-tiling.ps
Created October 14, 2020 03:29
penrose-tiling.ps
%!
%%BoundingBox: 0 0 600 450
% ref. https://tartarus.org/~simon/20110412-penrose/penrose.xhtml
/N 8 def
/linecolor { 0 0.2 0.6 setrgbcolor } def
/fillcolor { 0.8 0.9 1.0 setrgbcolor } def
0.5 setlinewidth