Skip to content

Instantly share code, notes, and snippets.

@JarkoDubbeldam
JarkoDubbeldam / output.txt
Created March 19, 2018 12:42
Comparison of data.table::fread with and without file:///
With a dataset of 16,592,802 rows (0.683GB):
Unit: seconds
expr min lq mean median uq max neval
fread("file") 14.51960 14.68574 18.82770 18.23437 22.39358 24.57221 10
fread("file:///file") 15.98431 16.19990 19.78759 17.80094 20.29927 36.96590 10
library(readr)
library(dplyr)
library(lubridate)
library(ggplot2)
library(tidyr)
data <- read_csv("~/traffic_2018-Jun-20_2018-Oct-18.csv")
data <- data %>%
mutate(Week = lubridate::isoweek(date),
@JarkoDubbeldam
JarkoDubbeldam / eating.cs
Created November 21, 2018 10:44
How much did Eater eat
public interface IEatable {
bool Eat();
}
public class Wateringhole : IEatable {
public bool Eat() {
// Always eat 1, so don't need to return anything.
// Whatever
return true;
public bool TryGetValue(TKey key, out TValue value) { // key is hier input, value is waar de output in komt.
int i = FindEntry(key); // Probeer de key te vinden.
if (i >= 0) { // Als die er is, succes!
value = entries[i].value; // Assign de waarde naar value, de output.
return true; // En return true om aan te geven dat het gelukt is.
} // Zo niet:
value = default(TValue); // De compiler vindt dat we per se hier iets in moeten vullen. We hebben de waarde niet gevonden, dus maar default.
return false; // Return false om aan te geven dat het niet gelukt is.
}
// Eagerly performs nullchecks.
public static IEnumerable<TResult> ZipNew<TFirst, TSecond, TResult>(
this IEnumerable<TFirst> first,
IEnumerable<TSecond> second,
Func<TFirst, TSecond, TResult> resultSelector) {
if(first == null) throw new ArgumentNullException(nameof(first));
if(second == null) throw new ArgumentNullException(nameof(second));
if(resultSelector == null) throw new ArgumentNullException(nameof(resultSelector));
return ZipNewInternal(first, second, resultSelector);
}
VALUES = {"2": 2, "1": 1, "0": 0, "-": -1, "=": -2}
LETTERS = {2: "2", 1: "1", 0: "0", -1: "-", -2: "="}
def add_snafu(left: str, right: str) -> str:
carry = 0
left_list, right_list = list(left), list(right)
sum = []
ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.11)
def get_visible_indexes(sequence: list[int]) -> list[int]:
running_max = -1
for index, value in enumerate(sequence):
if value > running_max:
running_max = value
yield index
def parse_inputs(text: str) -> list[list[int]]:
return [[int(value) for value in line] for line in text.splitlines()]