Skip to content

Instantly share code, notes, and snippets.

@onionmk2
onionmk2 / edge.py
Last active December 27, 2018 15:52
# VEXで下記のコードが事前に必要です。
# i[]@neighbours = neighbours(0, @ptnum);
# i@point_number = @ptnum;
# [ [0, 1], [0, 3] ...] というように、edgeとなるpointの組を返します。
# get_point_pair_for_edge("point_number", "neighbours")
def get_point_pair_for_edge(ptnum_attr_name, neighbours_attr_name):
# type: (str, str) -> List[List[int]]
import hou
from itertools import chain
W
PY
intrinsic:pointcount
intrinsic:bounds
intrinsic:measuredarea
intrinsic:memoryusage
@elemnum
@ptnum
@primnum
// paste this into web console
codes = $("code");
contents = Array.from(codes).map(i => i.textContent); //.filter(i => i.includes("@"));
uniqs = contents.filter((v, i, a) => a.indexOf(v) === i);
copy(uniqs.join('\n')); // save array to clipboard
@onionmk2
onionmk2 / pixologic.css
Created July 31, 2018 03:13
stylus for pixologic
.entry-content > ul > li {
margin: 0 0 0 36px;
}
.entry-content > ul {
list-style-type: circle;
}
.entry-content > ol {
list-style-type: decimal;
}
h2 {
@onionmk2
onionmk2 / VR MAGICの動画メモ.md
Last active July 11, 2018 05:37
【Unite 2017 Tokyo】VR MAGIC! ~キャラクターに命を吹き込んだこの4年間の記録~ https://www.youtube.com/watch?v=nWR816af2dU の動画でさらに理解がすすんだところ

イキイキしたキャラクター表現

プレゼンス

ハイライト

  • PS2くらいまではリソース不足のため、テクスチャにハイライトを書き込んでいた
  • ライトの色を変えたら、目のハイライトまでそのまま変わってしまい、イキイキ感が減る
@onionmk2
onionmk2 / use_cudaMallocManaged.cu
Last active January 8, 2018 11:21
use_cudaMallocManaged.cu
#include <cuda_runtime.h>
#include <iostream>
#include <device_launch_parameters.h>
#include "cuda_error_detector.h"
#include <vector>
#ifdef __CUDACC__
#define KERNEL_ARGS2(numerOfBlocks, threadsPerBlock) <<< numerOfBlocks, threadsPerBlock >>>
#define KERNEL_ARGS3(numerOfBlocks, threadsPerBlock, sh_mem) <<< numerOfBlocks, threadsPerBlock, sh_mem >>>
@onionmk2
onionmk2 / KERNEL_ARGS.cu
Created January 6, 2018 09:16
kill cuda intellisense error. original: https://stackoverflow.com/a/27992604/6430832
#ifdef __CUDACC__
#define KERNEL_ARGS2(numerOfBlocks, threadsPerBlock) <<< numerOfBlocks, threadsPerBlock >>>
#define KERNEL_ARGS3(numerOfBlocks, threadsPerBlock, sh_mem) <<< numerOfBlocks, threadsPerBlock, sh_mem >>>
#define KERNEL_ARGS4(numerOfBlocks, threadsPerBlock, sh_mem, stream) <<< numerOfBlocks, threadsPerBlock, sh_mem, stream >>>
#else
#define KERNEL_ARGS2(numerOfBlocks, threadsPerBlock)
#define KERNEL_ARGS3(numerOfBlocks, threadsPerBlock, sh_mem)
#define KERNEL_ARGS4(numerOfBlocks, threadsPerBlock, sh_mem, stream)
#endif
@onionmk2
onionmk2 / get_global_id.cu
Last active January 5, 2018 02:12 — forked from athiakos/cuda cheat sheet
cuda のid計算がよくわからないので、まとめてみる。
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
namespace comment_thread_id
{
/*
blockIdx.x == n
blockIdx.y == 1
blockIdx.z == 1
// Define this to turn on error checking
// original https://codeyarns.com/2011/03/02/how-to-do-error-checking-in-cuda/
#ifndef CUDA_ERROR_DETECTOR_H
#define CUDA_ERROR_DETECTOR_H
#define CUDA_ERROR_CHECK
#define CudaSafeCall(err) CUDA_ERROR_DETECTOR::__cudaSafeCall(__FUNCTION__, err, __FILE__, __LINE__ ) // __FUNCTION__ https://stackoverflow.com/questions/679021/how-to-find-the-name-of-the-current-function-at-runtime
#define CudaCheckError() CUDA_ERROR_DETECTOR::__cudaCheckError(__FUNCTION__, __FILE__, __LINE__ )
from sympy.tensor.tensor import TensorIndexType, tensor_indices, tensorhead, TensorManager
Lorentz = TensorIndexType('Lorentz')
i0, i1, i2, i3, i4 = tensor_indices('i0:5', Lorentz)
A = tensorhead('A', [Lorentz], [[1]])
G = tensorhead('G', [Lorentz], [[1]], 'Gcomm')
GH = tensorhead('GH', [Lorentz], [[1]], 'GHcomm')
TensorManager.set_comm('Gcomm', 'GHcomm', 0)
(GH(i1) * G(i0)).canon_bp()