Skip to content

Instantly share code, notes, and snippets.

@Holt59
Holt59 / polymorphic_hash.cpp
Last active August 23, 2017 13:09
Polymorphic hash implementation, without templated HashAlgorithm
#include <array>
#include <functional>
#include <typeinfo>
#include <unordered_map>
#include <memory>
#include <utility>
#include <iostream>
#include <typeindex>
// std::apply
#include <array>
template<class T, size_t size, size_t... sizes>
struct MArr {
constexpr static std::size_t ndims = sizeof...(sizes) + 1;
typedef std::array<typename MArr<T, sizes...>::type, size> type;
std::array<MArr<T, sizes...>,size> data;
@Holt59
Holt59 / main.cpp
Created January 22, 2018 11:38
std::async to read big text file
#include <string>
#include <set>
#include <future>
#include <iostream>
#include <memory>
#include <fstream>
#include <chrono>
class InputReader {
public:
@Holt59
Holt59 / multicoldate.py
Created October 1, 2018 10:08
Pandas multicolumns dates
import io
import pandas as pd
s = """something a b c d message month day year
one 1 2 3.0 4 NaN 10 10 2018
two 5 6 NaN 8 world 10 16 2018
three 9 10 11.0 12 foo 11 15 2018"""
print(pd.read_table(io.StringIO(s), sep=' ', parse_dates={'date': ['month', 'day', 'year']}))
@Holt59
Holt59 / list.hpp
Created January 2, 2019 13:59
List implementation
// Extra comments:
// - Check the copy-and-swap idiom, i.e., implement a swap method for your List and then use it
// for the copy and move operator: https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Copy-and-swap
// - Do not provide constructor or operator that takes non-const reference, see the rule or 0/3/5:
// https://en.wikipedia.org/wiki/Rule_of_three_%28C%2B%2B_programming%29
// - There are a lot of utility functions in the C++ standard that could help you, in particular,
// check copy and copy_n: https://en.cppreference.com/w/cpp/algorithm/copy or equal_range
// https://en.cppreference.com/w/cpp/algorithm/equal_range
#include <stdexcept>
@Holt59
Holt59 / Dockerfile
Created March 19, 2019 17:12
Dockerfile for AI Crowd Unity Obstacle Tower challenge
FROM nvidia/cuda:9.0-cudnn7-runtime-ubuntu16.04
# avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq && \
apt-get install -qq --yes --no-install-recommends \
software-properties-common
# Set up locales properly
@Holt59
Holt59 / Player.log
Created March 28, 2019 08:20
Player.log after crash (Unity Obstacle Tower environment)
Desktop is 1280 x 1024 @ 0 Hz
Invalid initial resolution 84 x 84 - forcing to 100 x 100
Initialize engine version: 2018.2.17f1 (88933597c842)
GfxDevice: creating device client; threaded=1
Renderer: Tesla K80/PCIe/SSE2
Vendor: NVIDIA Corporation
Version: 4.5.0 NVIDIA 410.72
GLES: 0
GL_AMD_multi_draw_indirect GL_AMD_seamless_cubemap_per_texture GL_ARB_arrays_of_arrays GL_ARB_base_instance GL_ARB_bindless_texture GL_ARB_blend_func_extended GL_ARB_buf
fer_storage GL_ARB_clear_buffer_object GL_ARB_clear_texture GL_ARB_clip_control GL_ARB_color_buffer_float GL_ARB_compressed_texture_pixel_storage GL_ARB_conservative_dept
@Holt59
Holt59 / _mobase.pyi
Last active May 10, 2020 16:03
Stubs file for ModOrganizer2 Python Interface - For 2.3.0a8 version.
from enum import Enum
from typing import Dict, Iterable, Iterator, List, Tuple, Union, Any, Optional, Callable, overload
import PyQt5.QtCore
import PyQt5.QtGui
import PyQt5.QtWidgets
class InterfaceNotImplemented: pass
class GuessQuality(Enum):
INVALID = 0
@Holt59
Holt59 / install_on_download.py
Last active May 13, 2020 12:30
MO2 python test plugin - Install after download
# -*- encoding: utf-8 -*-
from PyQt5.QtCore import QCoreApplication
import mobase
class InstallAfterDownload(mobase.IPlugin):
def __init__(self):
super().__init__()
@Holt59
Holt59 / README.md
Last active May 21, 2020 13:23
MO2 Plugin Python README

Mod Organizer 2 - Plugin Python Proxy

This repository contains the implementation of the proxy plugin for python language plugins in Mod Organizer 2.

This README is intended for MO2 developers, not plugin creators. If you are looking for documentation on how to create a python plugin, please refer to the MO2 wiki.