Skip to content

Instantly share code, notes, and snippets.

View hi2p-perim's full-sized avatar
💭
Nothing just works

Hisanari Otsu hi2p-perim

💭
Nothing just works
View GitHub Profile
@hi2p-perim
hi2p-perim / seed.cpp
Created March 12, 2015 12:50
Utilizing 種田梨沙さん as random seed for std::mt19937. Checked with VS2013.
#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 / dynamiccastunique.cpp
Created March 22, 2015 17:37
dynamic_cast with unique_ptr
#include <iostream>
#include <memory>
struct A
{
virtual ~A() {}
};
struct B : public A
{
@hi2p-perim
hi2p-perim / vectorelementpointer.cpp
Last active August 29, 2015 14:18
A notice on utilizing pointer to vector elements
#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 / exrtopng.sh
Last active April 25, 2016 11:35
Convert multiple .exr files to .png with gamma correction
find . | grep \.exr$ | sed 'p;s/\.exr/\.png/' | xargs -n2 convert -gamma 2.2
@hi2p-perim
hi2p-perim / open_latest.sh
Created June 22, 2016 05:26
Open the latest file from the terminal (checked with msys2)
start `ls -t | head -1`
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.