This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace impl { | |
template <int n, bool isPositive> | |
struct fib_impl { | |
static constexpr int val = fib_impl<n - 1, isPositive>::val + fib_impl<n - 2, isPositive>::val; | |
}; | |
template <> | |
struct fib_impl<1, true> { | |
static constexpr int val = 1; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <int n, int prev, int next, bool isPositive> | |
struct fib_impl { | |
static constexpr int val = fib_impl<n - 1, next, prev + next, isPositive>::val; | |
}; | |
template <int prev, int next> | |
struct fib_impl<0, prev, next, true> { | |
static constexpr int val = prev; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdlib> | |
#include <iostream> | |
#include <vector> | |
#include <sstream> | |
#include "pstl/execution" | |
#include "pstl/algorithm" | |
#include "pstl/numeric" | |
#include "pstl/memory" | |
#include "tbb/task_scheduler_init.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List.Split (splitOn) | |
main :: IO () | |
main = do | |
contents <- getContents | |
let path = minPath $ csv3ToRoadSecs (lines contents) | |
let repr = pictoralRepr (pathStr path) | |
-- Need to deal with last character | |
let lastRepr = foldPaths repr (prev repr) | |
print $ "Minimum distance travelled: " ++ show (pathDist path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from abc import ABCMeta, abstractmethod | |
class StorageStrategy(metaclass=ABCMeta): | |
@abstractmethod | |
def printSomething(self, something): | |
pass | |
class MongoDBStorageStrategy(StorageStrategy): | |
def printSomething(self, something): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <valarray> | |
#include <sstream> | |
#include <fstream> | |
#include <string> | |
#include <numeric> | |
#include <cmath> | |
#include <chrono> | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <math.h> | |
typedef struct { | |
float mean; | |
float std; | |
} MeanStd_f; | |
float compute_mean_f( | |
const float *a, | |
const int *x_dim, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module SemVer where | |
import Control.Applicative | |
import Text.Trifecta | |
import Data.Maybe | |
data NumberOrString = | |
NOSS String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import pandas as pd | |
import numpy as np | |
from pathlib import Path | |
from scipy import signal | |
from librosa import load | |
from sklearn.preprocessing import MinMaxScaler | |
from PIL import Image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getNeighborCellFromCell :: Maze -> Cell -> Direction -> Cell | |
getNeighborCellFromCell maze cell North = ... | |
getNeighborCellFromCell maze cell East = ... |
OlderNewer