Skip to content

Instantly share code, notes, and snippets.

@mebiusbox
mebiusbox / README.md
Last active February 29, 2024 21:23
mdbook template

Math

Mathjax がサポートされている.

[output.html]
mathjax-support = true

ただ、デリミタが \\[,\\], \\(, \\) で使いづらい.さらに \\ はエスケープする必要がある.

@mebiusbox
mebiusbox / enen_Cambridge.js
Last active August 1, 2022 09:08
Cambridge Dictionary for Online Dictionary Helper
/* global api */
class enen_Cambridge {
constructor(options) {
this.options = options;
this.maxexample = 2;
this.word = '';
}
async displayName() {
// let locale = await api.locale();
@mebiusbox
mebiusbox / notion-tweaks.css
Created January 1, 2022 12:21
my custom css for notion-enhancer
.notion-code-block.line-numbers > div {
padding-top: 14px !important;
padding-bottom: 14px !important;
}
.notion-code-block .code_line_numbers--plain {
top: 14px !important;
bottom: 14px !important;
}
.notion-dark-theme [style*="rgb(159, 164, 169)"],
@mebiusbox
mebiusbox / winodw.rs
Last active January 7, 2021 07:27
Use minifb to display the generated image of type image::RgbImage in a window
// image = "*"
// minifb = "0.19.1"
use crate::{
IMAGE_HEIGHT, IMAGE_WIDTH,
};
use minifb::{Key, Window, WindowOptions};
use image::{RgbImage};
pub fn draw_in_window(mut pixels: RgbImage) -> std::io::Result<()>
{
@mebiusbox
mebiusbox / book.py
Last active December 31, 2019 14:22
Get book information by ISBN10 or ISBN13 with google books API
import sys
import urllib.request
import urllib.parse
import json
import objectpath
import pyperclip
import re
# API Endpoint
API_URL = "https://www.googleapis.com/books/v1/"
@mebiusbox
mebiusbox / plot_tonemap_ue4_gt.py
Created May 11, 2019 03:52
ToneMap UE4+GT Plot
import matplotlib
matplotlib.use('TkAgg')
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
import tkinter as tk
import tkinter.messagebox as tkmsg
import numpy as np
# https://github.com/ampas/aces-dev/blob/master/transforms/ctl/README-MATRIX.md
@mebiusbox
mebiusbox / GGXApproxDiffuse.brdf
Created September 8, 2017 14:25
GGX Approximation Diffuse for BRDF Explorer
analytic
# variables go here...
# only floats supported right now.
# [type] [name] [min val] [max val] [default val]
::begin parameters
float albedo 0 1 1
float roughness 0 1 1
::end parameters
@mebiusbox
mebiusbox / GotandaOrenNayar.brdf
Created September 8, 2017 14:24
GGX Oren-Nayar for BRDF Explorer
analytic
# variables go here...
# only floats supported right now.
# [type] [name] [min val] [max val] [default val]
::begin parameters
float roughness 0 1 1
float f0 0 1 0.04
::end parameters
@mebiusbox
mebiusbox / NormalizedOrenNayar.brdf
Created September 8, 2017 14:22
Normalized Oren-Nayar for BRDF explorer.
analytic
# variables go here...
# only floats supported right now.
# [type] [name] [min val] [max val] [default val]
::begin parameters
float roughness 0 1 1
float f0 0 1 0.04
bool fresnel 1
// BRDFs
#define PI 3.14159265359f
#define PI2 6.28318530718f
#define RECIPROCAL_PI 0.31830988618f
#define RECIPROCAL_PI2 0.15915494f
#define LOG2 1.442695f
#define EPSILON 1e-6
#define pow2(x) ((x)*(x))
#define pow3(x) pow2(x)*(x)