Skip to content

Instantly share code, notes, and snippets.

View n-yoda's full-sized avatar
🏠
Working from home

Nobuki Yoda n-yoda

🏠
Working from home
View GitHub Profile
@n-yoda
n-yoda / calculator.py
Created June 2, 2020 15:14
calculator.py
#!/usr/bin/python3
class Token(object):
symbol = None
@classmethod
def can_read(cls, line, index):
return line[index] == cls.symbol
@classmethod
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import tensorflow as tf
class UVPQ:
def __init__(self, w, h, p, q):
indices_x = tf.range(w, dtype=tf.int32)
indices_y = tf.range(h, dtype=tf.int32)
@n-yoda
n-yoda / alpha-trick.html
Created October 30, 2016 08:19
Alpha Trick
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>AlphaTrick</title>
</head>
<body>
<div>
<div>when bg is black: <input type="file" id="black"/></div>
<div>when bg is white: <input type="file" id="white"/></div>
@n-yoda
n-yoda / webgl.html
Created October 26, 2016 10:26
WebGL Image Processing Example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>WebGL Image Processing</title>
</head>
<body>
<input style="display:block;" type="file" id="texture"/>
<canvas style="display:block;" id="canvas" width="512" height="512"></canvas>
@n-yoda
n-yoda / CardboardHead.cs
Last active May 17, 2016 05:02
Quaternion.AngleAxis(90, Vector3.right) * new Quaternion(Input.gyro.attitude.x, Input.gyro.attitude.y, -Input.gyro.attitude.z, -Input.gyro.attitude.w)
// Copyright 2014 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
using UnityEngine;
using UnityEditor;
using UnityEngine.Assertions;
using System.Collections.Generic;
using System.IO;
public class BlackWhite
{
[MenuItem("Assets/Compose")]
static void Compose()
@n-yoda
n-yoda / demo.glsl
Last active October 22, 2016 07:31
Ray marching.
#ifdef GL_ES
precision mediump float;
#endif
#extension GL_OES_standard_derivatives : enable
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
@n-yoda
n-yoda / TerrainEditor.cs
Created December 21, 2015 04:49
UnityのTerrainの平行移動とか
using UnityEngine;
using UnityEditor;
using System;
using System.Reflection;
using System.Linq;
using System.Collections.Generic;
public class TerrainEditor : EditorWindow
{
int moveX = 10;
@n-yoda
n-yoda / WrappedInput.cs
Created December 21, 2015 04:46
Unityでダブルタップやトリプルタップを直接取れないプラットフォームでダブルタップを扱う何か。
using UnityEngine;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Touchのラッパー的なクラス。
/// </summary>
public struct WrappedTouch
{
public Touch original { get; private set; }
@n-yoda
n-yoda / sdf.cpp
Last active December 20, 2015 18:09
Render Font as Signed Distance Filed (WIP)
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <memory>
#include <fstream>
#include <sstream>
extern "C" {
#include <ft2build.h>