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
#include <Rcpp.h> | |
#include <boost/sort/spreadsort/spreadsort.hpp> | |
using namespace Rcpp; | |
using namespace boost::sort::spreadsort; | |
template <int RTYPE> | |
Vector<RTYPE> sort_impl(const Vector<RTYPE> & x, bool decreasing = false) { | |
Vector<RTYPE> res = no_init(x.size()); | |
std::copy(x.begin(), x.end(), res.begin()); |
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
#' @title Geolocate IP Addresses Through ip-api.com | |
#' @description | |
#' \code{geolocate} consumes a vector of IP addresses and geolocates them via | |
#' \href{http://ip-api.com}{ip-api.com}. | |
#' @param ip a character vector of IP addresses. | |
#' @param lang a string to specify an output localisation language. | |
#' Allowed values: en, de, es, pt-BR, fr, ja, zh-CN, ru. | |
#' @param fields a string to specify which fields to return. | |
#' @param delay a logical to whether or not to delay each request by 400ms. | |
#' ip-api.com has a maximum threshold of 150 requests a minute. Disable it for |
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
#!/usr/bin/env python3 | |
# Импорт библиотек | |
import sys | |
from urllib.request import Request, urlopen | |
from urllib.error import HTTPError | |
from html.parser import HTMLParser | |
import json | |
class Parser(HTMLParser): |
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
PANDOC_ARGS = --slide-level 2 --latex-engine=xelatex | |
MD_FILES = $(wildcard *.md) | |
PDF_FILES = $(patsubst %.md, %.pdf, $(MD_FILES)) | |
TEX_FILES = $(patsubst %.md, %.tex, $(MD_FILES)) | |
all: pdf | |
pdf: $(PDF_FILES) | |
tex: $(TEX_FILES) |
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
PKG_NAME = $(shell grep '^Package: ' DESCRIPTION | cut -d ':' -d ' ' -f 2) | |
PKG_VER = $(shell grep '^Version: ' DESCRIPTION | cut -d ':' -d ' ' -f 2) | |
PKG_TAR = $(PKG_NAME)_$(PKG_VER).tar.gz | |
BUILD_ARGS = --no-build-vignettes | |
CHECK_ARGS = --as-cran --no-manual --no-vignettes --no-build-vignettes | |
all: install doc check clean | |
install: | |
R --vanilla CMD INSTALL --no-test-load . |
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
variables: | |
CODECOV_TOKEN: "CODECOV_TOKEN_STRING" | |
_R_CHECK_CRAN_INCOMING_: "false" | |
_R_CHECK_FORCE_SUGGESTS_: "true" | |
APT_PKGS: "libcurl4-openssl-dev libssh2-1-dev libssl-dev libxml2-dev zlib1g-dev git" | |
before_script: | |
- apt-get update | |
- apt-get install -y --no-install-recommends ${APT_PKGS} | |
- apt-get install -y --no-install-recommends qpdf pandoc pandoc-citeproc |
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
#!/usr/bin/env python | |
from sys import argv | |
from random import choice | |
def gen_letters(nrows = 60, ncols = 40): | |
letters = "АБВГДЕЖЗИКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯ" | |
return "\n".join(" ".join(choice(letters) for i in range(ncols)) for j in range(nrows)) | |
def gen_numbers(nrows = 60, ncols = 40): |
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
// [[Rcpp::plugins(cpp11)]] | |
#include <Rcpp.h> | |
using namespace Rcpp; | |
// [[Rcpp::export]] | |
IntegerVector findInterval2(const NumericVector& x, const NumericVector& breaks) { | |
std::size_t n = x.size(); | |
IntegerVector out = no_init(n); |
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
// [[Rcpp::plugins(cpp11)]] | |
#include <Rcpp.h> | |
using namespace Rcpp; | |
template <int RTYPE> | |
Vector<RTYPE> shuffle_impl(const Vector<RTYPE>& x) { | |
Vector<RTYPE> res(x); // make copy | |
auto first = res.begin(), last = res.end(); |
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
#include <Rcpp.h> | |
using namespace Rcpp; | |
// [[Rcpp::plugins(cpp11)]] | |
template <int RTYPE> | |
Vector<RTYPE> rep_each_impl(const Vector<RTYPE>& x, std::size_t each) { | |
std::size_t n = x.size(); | |
Vector<RTYPE> res = no_init(n * each); | |
auto begin = res.begin(); |