Skip to content

Instantly share code, notes, and snippets.

View to-osaki's full-sized avatar
🌴
On vacation

to-osaki

🌴
On vacation
View GitHub Profile
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text.RegularExpressions;
using UnityEngine;
using ResponseCallback = System.Func<System.Net.HttpListenerRequest, System.Text.RegularExpressions.Match, ResponseValue>;
public class ResponseValue

Find track by type

T FindTrack<T>(PlayableGraph graph) where T : TrackAsset
{
  var director = (graph.GetResolver() as PlayableDirector);
  foreach (var binding in director.playableAsset.outputs)
  {
    if (binding.sourceObject is T track)
    {
      return track;

クリフォード/デヨン アトラクタ https://gihyo.jp/book/2021/978-4-297-12383-3

def Clifford(x, y, a = -1.1, b = -1, c = -3.0, d = -0.1): # -3 ~ 3
    x_ = np.sin(a*y) + c*np.cos(a*x)
    y_ = np.sin(b*x) + d*np.cos(b*y)
    return x_, y_

def DeJong(x, y, a = -2, b = -2.3, c = -1.4, d = 2.1): # -3 ~ 3

Generate AnimatorController by editor scripting

[SerializeField]
RuntimeAnimatorController ControllerAsset;

[ContextMenu("Generate")]
void Generate()
{
	var controller = ControllerAsset != null ?
@to-osaki
to-osaki / CreateAnimationClipAtRuntime.md
Last active April 17, 2022 12:29
create animation clip by script

transform

var pos = AnimationCurve.Linear(0f, 0f, 2f, 3f);
var rotate = AnimationCurve.Linear(0f, 0f, 2f, 45f);
var scale = AnimationCurve.Linear(0f, 0f, 2f, 2f);
var clip = new AnimationClip();
clip.SetCurve("", typeof(Transform), "m_LocalPosition.x", pos);
clip.SetCurve("", typeof(Transform), "localEulerAnglesRaw.y", rotate);
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
with open("test.depth", "rb") as file:
bins = np.frombuffer(file.read(), dtype = np.uint16).reshape(cols, rows)
plt.imshow(bins)
Image.fromarray((bins / 24).astype(np.uint8)).save("./test.jpg")
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
driver = webdriver.Chrome("./chromedriver_win32/chromedriver.exe")
driver.get("https://.../")
require 'mechanize'
require 'nokogiri'
agent = Mechanize.new
page = agent.get("http://yourei.jp/%E6%A4%9C%E7%B4%A2")
doc = page # Nokogiri::HTML.parse(File.read("body.html"))
table = doc.search("#sentence-example-list")
table.search("span.the-sentence").each do |node|
puts node.inner_text
@to-osaki
to-osaki / FindMissingEditor.cs
Last active August 17, 2024 15:26
Unity Find missing references
using UnityEngine;
using UnityEditor;
public class FindMissingEditor : EditorWindow
{
[MenuItem(itemName: "Menu/Find Missing References")]
public static void Open()
{
EditorWindow.GetWindow<FindMissingEditor>("Find Missing References").Show();
}
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; http://ahkwiki.net/KeyList
; ! = alt
; ^ = ctrl
; + = shift
; # = win