Skip to content

Instantly share code, notes, and snippets.

@nagadomi
nagadomi / 1_1_vertex_shader.glsl
Last active May 6, 2023 20:09
conversion of eeVR shader to MSL using https://github.com/septag/glslcc
#version 450
layout (location = POSITION) in vec3 aVertexPosition;
layout (location = TEXCOORD0) in vec2 aVertexTextureCoord;
layout (location = TEXCOORD0) out vec2 vTexCoord;
void main() {
vTexCoord = aVertexTextureCoord;
gl_Position = vec4(aVertexPosition, 1);
}
@nagadomi
nagadomi / 1_build_wasm.sh
Last active May 21, 2023 07:39
build onnxruntime-web webgpu on Ubuntu
#!/bin/bash
export NODE_OPTIONS=""
git submodule sync --recursive
git submodule update --init --recursive
BUILD_DIR=build_jsep_st
rm -fr ${BUILD_DIR}
cd cmake/external/emsdk
import numpy as np
from timeit import timeit
from collections import deque
# online running meanstd. ref https://github.com/ajcr/rolling/tree/master/rolling
class TimeRunningMeanStd(object):
def __init__(self, shape, ttl):
self.ttl = ttl
self.mean = np.zeros(shape, dtype=np.float64)
self.std = np.ones(shape, dtype=np.float64)
@nagadomi
nagadomi / se_block.lua
Created October 21, 2018 00:50
Torch7 SEBlock (Squeeze and Excitation Networks)
require 'nn'
local ScaleTable, parent = torch.class("nn.ScaleTable", "nn.Module")
function ScaleTable:__init()
parent.__init(self)
self.gradInput = {}
self.grad_tmp = torch.Tensor()
self.scale = torch.Tensor()
end
function ScaleTable:updateOutput(input)
# pip3 install python-dateutil websocket-client
import sys
import time
import json
import websocket
from dateutil.parser import parse as date_parse
from collections import deque
K=100
pack_buf = deque(maxlen=K)
# -*- coding: utf-8 -*-
# pip3 install xlrd python-dateutil
import xlrd
from datetime import datetime
from dateutil.parser import parse as date_parse
from collections import defaultdict
# 入力ファイル
@nagadomi
nagadomi / sdef_test.py
Last active August 30, 2024 03:57
MMD's SDEF Skinning on Blender
# -*- coding: utf-8 -*-
import bpy
from bpy.app.handlers import persistent
from mathutils import Vector, Matrix, Quaternion
from bpy.props import *
from bpy.types import Operator, Panel
import numpy as np
import time
# Test addon for SDEF
import os
import subprocess
import re
class Sentence():
class Phone():
def __init__(self, begin_frame, end_frame, phone):
self.begin_frame = begin_frame
self.end_frame = end_frame
self.phone = phone
# pip3 install websocket-client
import websocket
from multiprocessing import Process, Value, Lock, Event
from datetime import datetime
import dateutil.parser
import json
from time import sleep
class SFDInfo():
def __init__(self):
import websocket
import json
from pprint import pprint
def on_message(ws, message):
message = json.loads(message)
pprint(message)
def on_error(ws, error):
print(error)