Skip to content

Instantly share code, notes, and snippets.

View thorikawa's full-sized avatar

Takahiro "Poly" Horikawa thorikawa

View GitHub Profile
@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));
@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];
//整数に変換している
@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)
@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);
}
@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,
@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);
@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);
@faithandbrave
faithandbrave / emscripten_cmake_build.md
Last active June 11, 2024 21:14
EmscriptenとCMakeでのビルド方法

EmscriptenとCMakeでのビルド方法

Emscriptenは、C++をJavaScriptにコンパイルする、LLVMベースのコンパイラ。

このドキュメントでは、特定のプロジェクトに依存せず、Emscripten向けに、CMakeを使用してC++プロジェクトをビルドする方法を紹介する。

バージョン

このドキュメントで扱う各ツールのバージョンは、以下のものとする:

@eruffaldi
eruffaldi / arucomarker.py
Last active May 18, 2021 08:31
Multiple Aruco PDF Marker generator
import cairo,argparse,random
#TEST: https://jcmellado.github.io/js-aruco/getusermedia/getusermedia.html
#http://terpconnect.umd.edu/~jwelsh12/enes100/markergen.html
#http://terpconnect.umd.edu/~jwelsh12/enes100/markers.js
markers_opts = [[False,True,True,True,True],[False,True,False,False,False]
,[True,False,True,True,False],[True,False,False,False,True]];
import string
digs = string.digits + string.letters
@genekogan
genekogan / _Instructions.md
Last active September 21, 2024 10:33
instructions for generating a style transfer animation from a video

Instructions for making a Neural-Style movie

The following instructions are for creating your own animations using the style transfer technique described by Gatys, Ecker, and Bethge, and implemented by Justin Johnson. To see an example of such an animation, see this video of Alice in Wonderland re-styled by 17 paintings.

Setting up the environment

The easiest way to set up the environment is to simply load Samim's a pre-built Terminal.com snap or use another cloud service like Amazon EC2. Unfortunately the g2.2xlarge GPU instances cost $0.99 per hour, and depending on parameters selected, it may take 10-15 minutes to produce a 512px-wide image, so it can cost $2-3 to generate 1 sec of video at 12fps.

If you do load the