Skip to content

Instantly share code, notes, and snippets.

@yoya
yoya / fast_float_testbed_macos.c
Created August 24, 2020 05:54
lcms2 の plugins/fast_float/fast_float_testbed.c から macOS で failed する要素を抜いたもの
//---------------------------------------------------------------------------------
//
// Little Color Management System, fast floating point extensions
// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved
//
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
function A = DCC(I,k,T)
% This function implements the image interpolation algorithm
% based on the directional cubic convolution interpolation which
% has been described in the paper:
% D. Zhou, X. Shen, and W. Dong,
% Image zooming using directional cubic convolution interpolation,
% IET Image Processing, Vol. 6, No. 6, pp. 627-634, 2012.
%
% I(:,:) inputted low resolution gray image, range 0~1
@yoya
yoya / 8x1colors.ppm
Created November 13, 2019 06:39
8x1colors.ppm (testimage)
P3
8 1
255
#------ --------- --------- ---------- ---------- --------- --------- ---------
255 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 0 255 0
@yoya
yoya / 8x8colors.ppm
Created November 6, 2019 07:17
8x8colors.ppm (testimage)
P3
8 8
255
#------ --------- --------- ---------- ---------- --------- --------- ---------
255 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 0 255 0
0 0 0 255 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 255 0 0 0 0
0 0 0 0 0 0 100 0 0 0 0 255 0 0 255 0 100 0 0 0 0 0 0 0
0 0 255 0 0 255 0 0 255 100 0 100 0 100 100 0 0 255 0 0 255 0 0 255
0 0 255 0 0 255 0 0 255 0 100 100 100 0 100 0 0 255 0 0 255 0 0 255
0 0 0 0 0 0 0 100 0 0 0 255 0 0 255 100 0 0 0 0 0 0 0 0
@yoya
yoya / rms.js
Created October 7, 2019 15:26
Root Mean Square
// https://mathtrain.jp/leastsquares
// https://mathtrain.jp/covariance
function rms(xArr, yArr) {
var count = xArr.length;
if (count !== yArr.length) {
return false;
}
var xMean = xArr.reduce(function(a, b) { return a + b; }) / count;
var yMean = yArr.reduce(function(a, b) { return a + b; }) / count;
@yoya
yoya / sigmoid_compare.cpp
Created April 1, 2019 13:01
sigmoid equation compare
#include <iostream>
#include <cmath>
#include <cfloat>
static float sigmoid1(float x) {
return 1.0 / (1.0 + exp(-x));
}
static float sigmoid2(float x) {
return exp(x) / (1.0 + exp(x));
}
@yoya
yoya / sigmoid_test.cpp
Last active March 30, 2019 03:04
sigmoid test
#include <iostream>
#include <cmath>
static float sigmoid(float x) {
if (x > 0) {
return 1.0 / (1.0 + exp(-x));
} else {
return exp(x) / (1.0 + exp(x));
}
}
@yoya
yoya / webarchive.php
Last active November 17, 2023 16:13
get all history page from webarchive
<?php
function usage() {
echo "Usage: php webarchive.php <target_url> # http:// https:// only ".PHP_EOL;
echo "ex) php webarchive.php http://app.awm.jp".PHP_EOL;
}
if ($argc != 2) {
usage();
exit (1);
@yoya
yoya / shared.cc
Last active December 26, 2018 08:01
shared_ptr exercise
// g++ -std=c++11 shared.cc
#include <iostream>
#include <memory>
#include <sys/time.h>
#include <sys/resource.h>
class A {
private:
Version Information
Data exported 2018-12-20T14:03:16.679Z
Chrome version Chrome/73.0.3645.0
Operating system Windows NT 10.0.17134
Software rendering list URL https://chromium.googlesource.com/chromium/src/+/b2e486f0d5a83d34bd6bdd72ebbe2005063a8133/gpu/config/software_rendering_list.json
Driver bug list URL https://chromium.googlesource.com/chromium/src/+/b2e486f0d5a83d34bd6bdd72ebbe2005063a8133/gpu/config/gpu_driver_bug_list.json
ANGLE commit id 4638dc9def81
2D graphics backend Skia/73 6f27489c650284c9488d0a82ab03b31dc48656cc-
Command Line chrome.exe --enable-webgl2-compute-context --use-angle=gl --flag-switches-begin --flag-switches-end
Driver Information