Skip to content

Instantly share code, notes, and snippets.

View baku89's full-sized avatar

Baku Hashimoto baku89

View GitHub Profile
/*
{
"id": "cylinder-spray",
"label": "Cylinder Spray",
"icon": "❍",
"author": "Hiroyuki Sato"
}
*/
// @baku89: Added metadata so that the app can load.
private onDragstartScale({
current,
preventDefault,
originalEvent
}: {
current: vec2
preventDefault: () => void
originalEvent: MouseEvent
}) {
if (
@baku89
baku89 / restore-backup.py
Last active January 19, 2021 03:11
Restore the most recently opened file from the backup in $HOUDINI_TEMP_DIR after crashes
import hou
import glob, os, re
import shutil
from stat import ST_MTIME
from datetime import datetime
def main():
# Get a filename of the most recent opened file
userPrefDir = hou.getenv('HOUDINI_USER_PREF_DIR')
historyPath = os.path.join(userPrefDir, 'file.history')
(defn! round-rect (x y w h r)
(let
(R (if
(or (> r (/ w 2)) (> r (/ h 2)))
(min (/ w 2) (/ h 2))
r))
(list
"path"
`("M" ~(+ x R) ~y)
`("L" ~(+ x w (- R)) ~y)
(defn! pencil (state input) (do
(if (nil? (first state))
(def! state '((quote path) false false false)))
(let
(
; State
item (last (first state))
px (nth state 1)
(defn! distance (x1 y1 x2 y2)
(sqrt (+ (pow (- x2 x1) 2) (pow (- y2 y1) 2))))
(defn! pencil (state input) (do
(if (nil? (first state))
(def! state '((merge-path nil) 0 0 false)))
(let
(
(load-file "lib/tools.lisp")
(defn /2 (x) (/ x 2))
(g
(artboard "main" (0 0 400 400)
(background "skyblue")
(fill "red" (circle 0 0 $width))
(fill "blue" (rect 50 50 200 200))
(fill "green" (rect 224 312 200 200))
Hello World
Hello World
Hello World