Skip to content

Instantly share code, notes, and snippets.

View hpwxf's full-sized avatar

Pascal H. hpwxf

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hpwxf
hpwxf / chrono.cpp
Created March 4, 2020 15:58
Time measure using std::chrono
const auto start = std::chrono::system_clock::now();
process(...)
const auto end = std::chrono::system_clock::now();
auto elapsed = [=](auto start, auto end) {
return std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
};
@hpwxf
hpwxf / ObjectBindings.cpp
Created February 4, 2020 21:29
Object binding between C++ and R
// About C++11: https://teuder.github.io/rcpp4everyone_en/050_c++11.html
// [[Rcpp::plugins("cpp11")]]
/* R demo
*
* library(Rcpp)
* sourceCpp("test.cpp")
*/
#include <Rcpp.h>
@hpwxf
hpwxf / spaCy-demo.py
Created March 29, 2019 17:21
A small test on spaCy Natural Language handling
import spacy
from spacy import displacy
from pathlib import Path
# spaCy API Documentation : https://spacy.io/api
nlp = spacy.load("en_core_web_sm")
doc = nlp(u"Next friday at 1 PM, I will have lunch in Paris with my friend Chris, the one who has a red hair cat.")
options={"collapse_punct": True, "word_spacing":10, "distance":100}
@hpwxf
hpwxf / Dockerfile
Created March 29, 2019 15:02
spaCy Dockerfile
FROM python:3-slim
MAINTAINER Pascal Havé <pascal@haveneer.com>
VOLUME /data
EXPOSE 5000
RUN pip install -U spacy \
&& python -m spacy download en \
&& python -m spacy download fr \
&& python -m spacy download en_core_web_sm \
&& python -m spacy download en_core_web_md \
&& python -m spacy download en_core_web_lg
@hpwxf
hpwxf / plot.gp
Last active June 19, 2018 21:43 — forked from garethrees/plot.p
Graphing apache benchmark results with gnuplot
# Tell gnuplot to use tabs as the delimiter instead of spaces (default)
set datafile separator '\t'
# skip first line with 'every ::2' in following commands
# First stats file to extract min time value
# (must be done before setting that x will be a time data serie)
stats "out.dat" every ::2 using 2 prefix "A"
# Output to a jpeg file
@hpwxf
hpwxf / plot.gp
Last active June 19, 2018 21:42
Graphing of gnuplot data from Apache Benchmark. This plot show the % of requests completed (y-axis) before a given time (x-axis).
# Tell gnuplot to use tabs as the delimiter instead of spaces (default)
set datafile separator '\t'
# output as png image
set terminal png
# save file to "benchmark.png"
set output "benchmark.png"
# The graph title