Skip to content

Instantly share code, notes, and snippets.

View youz's full-sized avatar
🈳
kyomu

Yōsuke Ushiki youz

🈳
kyomu
View GitHub Profile
@youz
youz / export_wordle_stats.js
Created March 28, 2022 08:50
export wordle statistics data (bookmarklet)
javascript:((w)=>{let u=new URL(w.location);u.searchParams.set("data",JSON.stringify({"statistics":JSON.parse(w.localStorage.getItem("nyt-wordle-statistics")),"darkTheme":0}));w.prompt("copy url",u.href);})(window);
@youz
youz / query.sql
Last active September 29, 2021 08:05
new.db
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
@youz
youz / grass.rb
Last active August 9, 2021 06:40
Grass with call/cc extension ( forked from https://github.com/youz/grasses/blob/master/Ruby3/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 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)