Skip to content

Instantly share code, notes, and snippets.

View thorikawa's full-sized avatar

Takahiro "Poly" Horikawa thorikawa

View GitHub Profile
@naojitaniguchi
naojitaniguchi / VideoPicker.cs
Last active September 15, 2020 10:17
Video Picker for Unity iOS native plugin call sample, Using UIImagePickerController
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
public class VideoPicker : MonoBehaviour {
public Texture2D shareButtonImage; // Use this for initialization
[DllImport("__Internal")]
private static extern void OpenVideoPicker(string game_object_name, string function_name);
@cbirkhold
cbirkhold / MTLTextureFromUIImage.m
Last active May 26, 2020 18:21
Loading a UIImage into a MTLTexture.
// context: m_width, m_height of m_texture (MTLTexture), m_path (NSString) location of the image
// assumptions: loading RGBA8 image from main bundle
NSString *const path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:m_path];
UIImage *const image = [UIImage imageWithContentsOfFile:path];
const NSUInteger bitsPerComponent = 8;
const NSUInteger bytesPerRow = ((bitsPerComponent * 4 / 8) * m_width);
const CGBitmapInfo bitmapInfo = CGBitmapInfo(kCGImageAlphaPremultipliedLast);
@edom18
edom18 / defines-pixel-format
Created May 7, 2015 01:27
[Metal] テクスチャ(MTLTexture)を使う ref: http://qiita.com/edo_m18/items/6e44308d1b865e614f7c
typedef enum : NSUInteger {
MTLPixelFormatInvalid = 0,
/* Ordinary 8 bit formats */
MTLPixelFormatA8Unorm = 1,
MTLPixelFormatR8Unorm = 10,
MTLPixelFormatR8Unorm_sRGB = 11,
MTLPixelFormatR8Snorm = 12,
MTLPixelFormatR8Uint = 13,
MTLPixelFormatR8Sint = 14,
@kijtra
kijtra / twitter.gs
Last active December 30, 2019 09:18
Google Apps Script での 「oAuthConfig」のサポート終了後用の Twitter API スクリプト。「OAuth1」ライブラリ(ID:Mb2Vpd5nfD3Pz-_a-39Q4VfxhMjh3Sh48)が必要。
// 最初にこの関数を実行し、ログに出力されたURLにアクセスしてOAuth認証する
function twitterAuthorizeUrl() {
Twitter.oauth.showUrl();
}
// OAuth認証成功後のコールバック関数
function twitterAuthorizeCallback(request) {
return Twitter.oauth.callback(request);
}
@ginrou
ginrou / construct_lenna.py
Last active September 9, 2025 10:27
DCTでlennaを再構成する
#!/bin/env python
import numpy as np
import scipy.misc
from scipy.fftpack import dct, idct
import sys
H = 128
W = 128
lenna = scipy.misc.imresize(scipy.misc.lena(), (H, W)).astype(float)
@ochilab
ochilab / showKinectColorBody.cs
Created March 13, 2015 10:41
Kinect v2でbodyIndexFrameを利用して人物画像(RGB)を抜き出す
//人物インデックスフレームデータを_bodyDataにコピー
bodyIndexFrame.CopyFrameDataToArray(_bodyData);
//depthframeからカラースペースに
kinect.CoordinateMapper.MapDepthFrameToColorSpace(_depthData, _colorPoints);
for (int depthIndex=0; depthIndex < length; depthIndex++){
byte player = _bodyData[depthIndex];
//もし人物の領域ならば
if (player != 0xff){
ColorSpacePoint colorPoint = _colorPoints[depthIndex];
//整数に変換している
@danharper
danharper / gulpfile.js
Last active September 25, 2024 09:04
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@3v1n0
3v1n0 / gpControl.json
Last active November 2, 2020 22:05
GoPro Hero4 Remote tools
{
"version":2.0,
"display_hints":[
{
"key":"GPCAMERA_GROUP_VIDEO",
"display_name":"Video Settings",
"settings":[
{
"setting_id":5,
"widget_type":"select",
@justmoon
justmoon / custom-error.js
Last active November 19, 2024 02:40 — forked from subfuzion/error.md
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
@gatlingxyz
gatlingxyz / gist:52fb21eb92181716b0ce
Created July 11, 2014 23:49
Unofficial Base WatchFace Activity
import android.app.Activity;
import android.content.Context;
import android.hardware.display.DisplayManager;
import android.os.Bundle;
import android.view.Display;
/**
* A base activity for watch faces that have callbacks for the various screen states (dim, awake, and off)
* as well as a callback for when the watch face is removed.
* <p/>