This file contains hidden or 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
library(tidyverse) | |
library(htmltab) | |
# right-click and save HTML | |
# this is the results page, e.g. http://www.parkrun.org.uk/henleyonthames/results/weeklyresults/?runSeqNumber=2 | |
doc <- read_file("results _ henleyonthames parkrun_2.html") | |
df <- as_tibble(htmltab(doc=doc, which="//table[@id='results']")) | |
colnames(df) <- c("pos", "name", "time", "age_cat", "age_grade", "gender", "gender_pos", "note", "total_runs") | |
df$pos <- as.numeric(df$pos) |
This file contains hidden or 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
// sorted vector functions | |
template<typename Key, typename T> | |
typename std::vector<std::pair<Key, T>>::iterator | |
lookup(std::vector<std::pair<Key, T>> &vec, Key key) | |
{ | |
auto const end = vec.end(); | |
auto it = lower_bound(vec.begin(), end, key, [](std::vector<std::pair<Key, T>>::value_type const &elem, Key key) { | |
return elem.first < key; | |
}); |
This file contains hidden or 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
# From https://spin.atomicobject.com/2016/08/26/makefile-c-projects/ | |
TARGET_EXEC ?= a.out | |
BUILD_DIR ?= ./build | |
SRC_DIRS ?= ./src | |
SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s) | |
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o) | |
DEPS := $(OBJS:.o=.d) |