Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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:
#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 / 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