Skip to content

Instantly share code, notes, and snippets.

View soma-arc's full-sized avatar

soma soma-arc

View GitHub Profile
export LIBGL_ALWAYS_INDIRECT=1
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0.0
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
export PATH=$PATH:~/bin
;;; init.el --- My init.el -*- lexical-binding: t; -*-
(eval-and-compile
(when (or load-file-name byte-compile-current-file)
(setq user-emacs-directory
(expand-file-name
(file-name-directory (or load-file-name byte-compile-current-file))))))
(eval-and-compile
(customize-set-variable
@soma-arc
soma-arc / moodleStackTest.xml
Created April 22, 2021 04:56
This file is provided by Shoichi Fujita
<?xml version="1.0" encoding="UTF-8"?>
<quiz>
<!-- question: 1 -->
<question type="stack">
<name>
<text>test</text>
</name>
<questiontext format="html">
<text><![CDATA[<p></p>
<p>次の微分をせよ.</p>
@soma-arc
soma-arc / build_appleseed.sh
Last active April 7, 2018 10:53
Build appleseed renderer (https://appleseedhq.net/)
#!/bin/sh
echo 'cloning......'
git clone git@github.com:appleseedhq/prebuilt-linux-deps.git
git clone git@github.com:appleseedhq/appleseed.git
echo 'Done'
export APPLESEED_INSTALL_DIR=$PWD/appleseed-dist
export APPLESEED_ROOT=$PWD/appleseed
export APPLESEED_DEPENDENCIES=$PWD/prebuilt-linux-deps
float3 origin = float3(-2, -2, -2);
float3 n = float3(2, 2, 2);
float3 s = float3(0.01, 0.01, 0.01);
int3 dim = int3(int((n.x() - origin.x()) / s.x()),
int((n.y() - origin.y()) / s.y()),
int((n.z() - origin.z()) / s.z()));
int numPoints = dim.x() * dim.y() * dim.z();
std::vector<int> invNums;
invNums.resize(numPoints);
@soma-arc
soma-arc / genVtk.cpp
Created December 23, 2017 12:18
Generate vtk file of fractal.
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <vector>
#include <cmath>
#include "nanort.h"
typedef nanort::real3<int> int3;
typedef nanort::real3<float> float3;
typedef nanort::real3<double> double3;
@soma-arc
soma-arc / gltf-metallic-roughness.brdf
Last active June 15, 2019 11:57
glTF 2.0 PBR materials metaric-roughness shader for BRDF Explorer
analytic
# glTF 2.0 PBR Materials
# metallic-roughness
# Reference:
# glTF Specification, 2.0
# https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#metallic-roughness-material
# glTF 2.0: PBR Materials by Saurabh Bhatia. May 2017
# https://www.khronos.org/assets/uploads/developers/library/2017-gtc/glTF-2.0-and-PBR-GTC_May17.pdf
# glTF-WebGL-PBR
digraph graph_name {
ranksep=1.5;
graph [
charset = "UTF-8";
layout = twopi
];
node [
fixedsize = true,
@soma-arc
soma-arc / 51-android.rules
Last active February 23, 2017 06:52
/etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="054c", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666", GROUP="plugdev"
(enable-console-print!)
(defonce gl (aget js/window "deps" "gl"))
(defonce shaders (.-Shaders gl))
(defonce surface (.-Surface (aget js/window "deps" "surface")))
(defonce hello-shader
(.create shaders
(clj->js {:hello {:frag "precision highp float;
varying vec2 uv;