Skip to content

Instantly share code, notes, and snippets.

Avatar
🈳
kyomu

Yōsuke Ushiki youz

🈳
kyomu
View GitHub Profile
View query.sql
WITH consts AS (
SELECT
8 AS n, -- number of iterations
500 AS l, -- width & height of image
0.7265425280053609 AS tan36, -- tan(π/5)
0.6180339887498948 AS d -- 1/φ
), tiles (p, i, t, px, py, qx, qy, rx, ry, sx, sy, tx, ty) AS (
SELECT 0, n, 1, -l/tan36, 0, 0, l, l/tan36, 0, 0, 0, 0, 0 FROM consts
UNION ALL SELECT 1, i-1, t, px, py, qx, qy, rx, ry, (qx-px)*d+px, (qy-py)*d+py, (rx-px)*d+px, (ry-py)*d+py
View grass.rb
#!/usr/bin/ruby
#
# grass.rb - Grass interpreter
# with call/cc extension
# http://www.blue.sky.or.jp/grass/
#
# Copyright (C) 2020-2021 Yousuke Ushiki All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@youz
youz / dice.rb
Last active Jun 4, 2021
usage: ruby dice.rb 8 5 | ruby judge.rb | sed -f nko.sed
View dice.rb
ndice = $*[0].to_i
rounds = $*[1].to_i
rounds.times {
puts ndice.times.map{(rand(6)+1).to_s}*" "
}
View snowflake.ps
%!
%%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 Feb 19, 2021
ゲーミングWindowsTerminal
View gaming.hlsl
Texture2D shaderTexture;
SamplerState samplerState;
cbuffer PixelShaderSettings {
float Time;
float Scale;
float2 Resolution;
float4 Background;
};
@youz
youz / gaming.hlsl
Last active Feb 5, 2021
Windows Terminal 1.6pre ピクセルシェーダ+Rubyスクリプトでアニメーション
View gaming.hlsl
Texture2D shaderTexture;
SamplerState samplerState;
cbuffer PixelShaderSettings {
float Time;
float Scale;
float2 Resolution;
float4 Background;
};
@youz
youz / grid.hlsl
Last active Feb 1, 2021
shaders for Windows Terminal
View grid.hlsl
Texture2D shaderTexture;
SamplerState samplerState;
cbuffer PixelShaderSettings {
float Time;
float Scale;
float2 Resolution;
float4 Background;
};
@youz
youz / pt2.sql
Last active Sep 30, 2021
penrose tiling in SQL
View pt2.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 Oct 29, 2020
Penrose tiling in SQL
View pt.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 Oct 20, 2020
wsl utility for xyzzy
View wsl.l
;;; -*- mode: lisp; package: wsl -*-
(defpackage :wsl
(:use :lisp :editor))
(in-package :wsl)
(export '(run-wsl
run-wsl-in-buffer
convert-wslpath-to-win