Note
Note
Tip
Tip
library(tidyverse) | |
library(gutenbergr) | |
constitution_raw <- gutenberg_download(5) | |
constitution <- constitution_raw |> | |
slice(36:546) |> | |
filter(text != "") |> | |
mutate(text_lc = str_to_lower(text)) |> | |
mutate(is_article = str_starts(text_lc, "article")) |> |
Note
Note
Tip
Tip
#!/bin/bash | |
# Function to measure execution time | |
measure_time() { | |
start_time=$(date +%s.%N) | |
"$@" | |
end_time=$(date +%s.%N) | |
execution_time=$(echo "$end_time - $start_time" | bc) | |
echo "Execution time: $execution_time seconds" | |
} |
library(magick) | |
library(lofifonts) # remotes::install_github('coolbutuseless/lofifonts') | |
library(purrr) | |
bitmap_text_coords("Hello", font = 'unifont') |> | |
head() | |
text <- glue::glue("It is a period of civil war. | |
Rebel spaceships, striking | |
from a hidden base, have won |
#' @export | |
new_schedule_builder <- function() { | |
builder <- list( | |
sec = "0", | |
min = "0", | |
hour = "0", | |
dom = "*", | |
month = "*", | |
dow = "*", | |
year = "*" |
``` r | |
A <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), nrow = 3, ncol = 4) | |
B <- matrix(c(13, 14, 15, 16, 17, 18, 19, 20), nrow = 4, ncol = 2) | |
dot_product <- function(x, y) { | |
mapply(\(x, y) sum(x * y), x, y) | |
} | |
rows_of <- function(m) purrr::array_tree(m, 1) | |
cols_of <- function(m) purrr::array_tree(m, 2) |
my_fun <- function() { | |
rlang::local_interactive() | |
rlang::check_installed(c("DiagrammeR (>= 1.0.9)", "DiagrammeRsvg")) | |
stopifnot(requireNamespace("DiagrammeR", quietly = TRUE)) | |
stopifnot(requireNamespace("DiagrammeRsvg", quietly = TRUE)) | |
} | |
my_fun() | |
#> ℹ The packages "DiagrammeR" (>= 1.0.9) and "DiagrammeRsvg" are required. | |
#> ✖ Would you like to install them? |
stack_rasters <- function(rasters, | |
raster_path, | |
..., | |
reference_layer = 1, | |
resampling_method = "bilinear") { | |
check_type_and_length( | |
reference_layer = integer(1) | |
) |
#!/bin/bash | |
### steps #### | |
# verify the system has a cuda-capable gpu | |
# download and install the nvidia cuda toolkit and cudnn | |
# setup environmental variables | |
# verify the installation | |
### | |
### to verify your gpu is cuda enable check |