Skip to content

Instantly share code, notes, and snippets.

💭
Nothing just works

Hisanari Otsu hi2p-perim

💭
Nothing just works
Block or report user

Report or block hi2p-perim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View lm3_example_custom_renderer.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hi2p-perim
hi2p-perim / open_latest.sh
Created Jun 22, 2016
Open the latest file from the terminal (checked with msys2)
View open_latest.sh
start `ls -t | head -1`
@hi2p-perim
hi2p-perim / exrtopng.sh
Last active Apr 25, 2016
Convert multiple .exr files to .png with gamma correction
View exrtopng.sh
find . | grep \.exr$ | sed 'p;s/\.exr/\.png/' | xargs -n2 convert -gamma 2.2
@hi2p-perim
hi2p-perim / vectorelementpointer.cpp
Last active Aug 29, 2015
A notice on utilizing pointer to vector elements
View vectorelementpointer.cpp
#include <iostream>
#include <vector>
#include <memory>
struct A { int v; };
struct B { const A* a; };
int main()
{
// NG. Taking raw pointer of an element of the vector.
@hi2p-perim
hi2p-perim / dynamiccastunique.cpp
Created Mar 22, 2015
dynamic_cast with unique_ptr
View dynamiccastunique.cpp
#include <iostream>
#include <memory>
struct A
{
virtual ~A() {}
};
struct B : public A
{
@hi2p-perim
hi2p-perim / seed.cpp
Created Mar 12, 2015
Utilizing 種田梨沙さん as random seed for std::mt19937. Checked with VS2013.
View seed.cpp
#include <iostream>
#include <random>
#include <functional>
#pragma execution_character_set("utf-8")
int main()
{
std::mt19937 eng(std::hash<std::string>()("種田梨沙"));
std::uniform_int_distribution<int> dist;
@hi2p-perim
hi2p-perim / cocoa.cpp
Created Jan 17, 2015
Composite numbers that Cocoa-chan should be careful to remember (cf. Gochiusa episode #10)
View cocoa.cpp
#include <iostream>
#include <vector>
int main()
{
for (int n = 2; n <= 9719; n++)
{
bool found = false;
int nn = n;
std::vector<int> a;
@hi2p-perim
hi2p-perim / assumetest.cpp
Last active Aug 29, 2015
Tricky compilation error with __assume. Checked with VS2013 (/W4 /WX options enabled)
View assumetest.cpp
#include <iostream>
struct A
{
int n;
A(int n) : n(n) {}
};
A Func(int n)
{
@hi2p-perim
hi2p-perim / boostpoolperf.cpp
Created Aug 5, 2014
Simple performance test of boost::pool
View boostpoolperf.cpp
#include <iostream>
#include <boost/pool/object_pool.hpp>
#include <vector>
#include <chrono>
class Pool
{
public:
virtual ~Pool() {}
@hi2p-perim
hi2p-perim / loadhdr.py
Created Mar 4, 2014
Load Radiance HDR file (.hdr) with python. Used : smc.freeimage, Pillow, OpenCV
View loadhdr.py
import array
import smc.freeimage as fi
from PIL import Image
import numpy as np
import cv2
def gamma_correction(a, gamma):
return np.power(a, 1/gamma)
def load_hdr(file):
You can’t perform that action at this time.