Skip to content

Instantly share code, notes, and snippets.

@yoya
yoya / httpsitecheck.php
Created August 14, 2024 08:41
HTTP Site Check
<?php
/*
* Example: php httpsitecheck.php http://www.playonline.com/ff11/campaign/wcb/data/conf.xml campaign_ $HOME/cron/ff11.xml
*/
$argc = count($argv);
if ($argc != 4) {
echo "Usage: php httpsitecheck.php <url> <keyword> <file>\n";
exit (1);
}
#! /bin/bash
set -euo pipefail
if [ $# -ne 3 ]; then
echo "Usage: ffmerge.sh input.mp4 input.wav output.mp4"
exit 1;
fi
iv="$1" ; ia="$2" ; o="$3"
@yoya
yoya / mexican_hat_deley.html
Last active June 25, 2024 16:13
mexican hat with delay
<html>
<body>
<canvas width="800" height="500" style="background-color:black"> </canvas>
<script>
"use strict"
const delay = 10
const canvas = document.querySelector("canvas")
const ctx = canvas.getContext("2d")
const {width, height} = canvas
ctx.fillStyle = "black"
@yoya
yoya / mexican_hat.html
Last active June 25, 2024 14:40
mexican hat
<html>
<body>
<canvas width="800" height="500" style="background-color:black"> </canvas>
<script>
"use strict"
const canvas = document.querySelector("canvas")
const ctx = canvas.getContext("2d")
const {width, height} = canvas
ctx.fillStyle = "black"
ctx.fillRect(0, 0, width, height)
@yoya
yoya / im_checkboard.sh
Last active January 6, 2024 15:37
checkboard maker powered by ImageMagick
#! /bin/bash
set -euo pipefail
# ImageMagick7 を使う時は convert を magick に書き換えた方が良いです。
IM_CONVERT=convert
if [ $# -ne 7 ];then
echo "Usage: im_checkboard.sh <width> <height> <unitx> <unity> <color1> <color2> <outputfile>"
echo "ex) im_checkboard.sh 100 100 50 70 red green output.png
exit 1
@yoya
yoya / iframe.html
Last active October 24, 2023 08:29
iframe postmessage bidirect
<html>
<body>
<div>
This is iframe
</div>
<script>
const origin = location.origin;
window.onload = () => {
window.addEventListener("message", (resp) => {
console.log("iframe", resp)
@yoya
yoya / wx.TextCtrl-EVT_KILK_FOCUS.py
Created October 7, 2023 05:42
wx.TextCtrl に EVT_KILK_FOCUS をセットするサンプル
import wx
class Frame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY, size=wx.Size(300, 200))
panel = wx.Panel(self, wx.ID_ANY)
self.text = "ABC..."
textCtrl = wx.TextCtrl(panel, wx.ID_ANY, self.text,
size=wx.Size(90, -1), style=wx.TE_PROCESS_ENTER)
for evt in [wx.EVT_KILL_FOCUS, wx.EVT_TEXT_ENTER]:
@yoya
yoya / sepia-palette-making.sh
Last active March 1, 2023 05:43
sepia-palette-making.sh
#! /bin/sh
magick -size 64x64 xc:"srgb( 30, 5, 3)" sepia-01.png
magick -size 64x64 xc:"srgb( 55, 23, 13)" sepia-02.png
magick -size 64x64 xc:"srgb( 80, 41, 23)" sepia-03.png
magick -size 64x64 xc:"srgb(102, 60, 37)" sepia-04.png
magick -size 64x64 xc:"srgb(122, 82, 58)" sepia-05.png
magick -size 64x64 xc:"srgb(142,107, 84)" sepia-06.png
magick -size 64x64 xc:"srgb(162,135,114)" sepia-07.png
magick -size 64x64 xc:"srgb(181,158,137)" sepia-08.png
@yoya
yoya / magick-asm-test.html
Last active December 16, 2022 05:00
sample for magick-asm without build tool.
<html>
<body>
<canvas id="canvasId"> </canvas>
<script type="module">
import { ImageMagick, initializeImageMagick } from './node_modules/@imagemagick/magick-wasm/dist/index.mjs';
const canvas = document.getElementById('canvasId')
initializeImageMagick().then(() => {
ImageMagick.read("logo:", (image) => image.writeToCanvas(canvas));
ImageMagick.readFromCanvas(canvas, (image) => {
const degrees = 90
@yoya
yoya / CMYKrectangle.sh
Last active June 21, 2022 11:18
CMYK rectangle by ImageMagick
convert -size 1024x1024 -background transparent xc: -compose darken \
\( xc: -draw "fill Cyan rectangle 100,100,600,650" \) -composite \
\( xc: -draw "fill Magenta rectangle 200,400,750,900" \) -composite \
\( xc: -draw "fill Yellow rectangle 350,250,1000,650" \) -composite \
-font KaiseiDecol-Regular.ttf +gravity -pointsize 256 -fill black -stroke black -strokewidth 18 \
-draw "rotate 15 text 190,270 C" \
-draw "rotate 0 text 350,870 M" \
-draw "rotate -10 text 700,650 Y" \
-draw "rotate 0 fill white stroke white text 390,620 K" \
CMYK.png ;