Skip to content

Instantly share code, notes, and snippets.

View asus4's full-sized avatar
:octocat:
Working from home

Koki Ibukuro asus4

:octocat:
Working from home
View GitHub Profile
void Start()
{
// Option
var options = new Interpreter.Options()
{
// Multithread
threads = 2,
// Metal option
gpuDelegate = new MetalDelegate(new MetalDelegate.Options()
{
// the image 28 * 28 grayscale
float[,] inputs = new float[28, 28];
// the array of probability
float[] outputs = new float[10];
void Start()
{
// Read bytes from model and make Interpreter
interpreter = new Interpreter(File.ReadAllBytes(path));
@asus4
asus4 / NativeArrayExtension.cs
Last active February 2, 2023 16:12
NativeArray -> byte[] , byte[] -> NativeArray
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
namespace ARKitStream.Internal
{
public static class NativeArrayExtension
{
public static byte[] ToRawBytes<T>(this NativeArray<T> arr) where T : struct
{
var slice = new NativeSlice<T>(arr).SliceConvert<byte>();
@asus4
asus4 / NativeArrayExtension.cs
Last active May 10, 2023 12:12
Safe Conversion of NativeArray <-> byte[] in Unity
using Unity.Collections;
public static class NativeArrayExtension
{
public static byte[] ToRawBytes<T>(this NativeArray<T> arr) where T : struct
{
var slice = new NativeSlice<T>(arr).SliceConvert<byte>();
var bytes = new byte[slice.Length];
slice.CopyTo(bytes);
return bytes;
@asus4
asus4 / Vimeo.vue
Created April 26, 2019 07:26
No cookie Youtube.vue and Vimeo.vue for website in EU
<template lang="pug">
.vimeo
.player(ref="player")
</template>
<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator'
import Player, { Options } from '@vimeo/player'
// Vue wrapper for
@asus4
asus4 / WindowFunction.cs
Created March 3, 2019 12:20
Custom implementation of Unity FFT Window Function
using UnityEngine;
namespace Fourier
{
public static class WindowFunction
{
// Implementation of Unity FFT Window Functions
// https://docs.unity3d.com/ScriptReference/FFTWindow.html
@asus4
asus4 / PCA9622.py
Created July 26, 2018 08:43
Control PCA9622 I2C LED Driver from Raspberry PI
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" PCA9622 """
from __future__ import print_function
import time
import smbus
@asus4
asus4 / BindSlider.cs
Created March 16, 2018 05:30
[Unity] Bind the slider value into a private float serialize field in any MonoBehaviour.
using System;
using System.Linq;
using System.Reflection;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace AppKit
{
[RequireComponent(typeof(Slider))]
@asus4
asus4 / BindSlider.cs
Created March 14, 2018 10:34
[Unity] Bind a slider UI value into any SerializeField, even private field.
using System;
using System.Linq;
using System.Reflection;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace AppKit
{
[RequireComponent(typeof(Slider))]
@asus4
asus4 / c_cpp_properties.json
Created February 14, 2018 11:54
VSCode C/C++ intellisense setting for Platform IO Arduino-ESP32
{
"name": "Platform IO",
"includePath": [
"${workspaceRoot}"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"$HOME/.platformio/packages/framework-arduinoespressif32",