Logs milliseconds for each leg of a websocket event.
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 ubuntu:latest | |
| # Install SSH server and SFTP | |
| RUN apt-get update && apt-get install -y openssh-server | |
| RUN mkdir /var/run/sshd | |
| # Create a new user 'sftpuser' with password 'password' (replace with your own credentials) | |
| RUN useradd -rm -d /home/sftpuser -s /bin/bash -g root -G sudo -u 1001 sftpuser | |
| RUN echo 'sftpuser:password' | chpasswd |
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(microbenchmark) | |
| long_way <- function(time_vector) { | |
| return( | |
| time_vector |> | |
| lapply(function(x){ | |
| (x |> | |
| str_match_all("[0-9]{1}") |> | |
| unlist() |> | |
| rev())[1:4] |> | |
| (\(time){ |
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
| con <- socketConnection( | |
| host="localhost", | |
| port = 6011, | |
| blocking=TRUE, | |
| server=FALSE, | |
| open="r+" | |
| ) | |
| the_data <- "testing this dang thing" | |
| write_resp <- writeLines(as.character(nchar(the_data)), con) |
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(sf) | |
| library(ggmap) | |
| library(ggplot2) | |
| library(ggthemes) | |
| library(dplyr) | |
| library(magrittr) | |
| library(data.table) | |
| # Fetching | |
| library(rvest) | |
| # Cleaning column names |
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(gt) | |
| mtcars %>% | |
| group_by(gear,cyl) %>% | |
| summarise( | |
| n = n(), | |
| mpg = mean(mpg) | |
| ) %>% (function(df){ | |
| df$gear[which(duplicated(df$gear))] <- ' ' | |
| return(df) |
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(jsonlite) | |
| df <- "https://api.inc.com/rest/i5list/2022" %>% | |
| fromJSON() %>% | |
| .$companies %>% | |
| bind_rows() %>% | |
| group_by(inc5000companyId) %>% | |
| mutate( | |
| article = ifelse(is.null(article %>% unlist %>% .[1]),NA,article %>% unlist %>% .[1]), | |
| editorsPick = editorsPick %>% unlist %>% paste(collapse = ",") |
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) | |
| df <- data.frame( | |
| x1 = rep(0,200), | |
| y1 = 21:220 + sample(1:10,200,replace = TRUE), | |
| g = 1:200 | |
| ) %>% | |
| cbind( | |
| data.frame( | |
| x2 = (200:1 + (sample(1:200,200,replace = TRUE)/100)) / 1.5, | |
| y2 = 1:200 - log(1:20) - (sample(1:200,200,replace = TRUE)/100) |
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(glue) | |
| library(jsonlite) | |
| library(lubridate) | |
| df <- c("user_a","user_b") %>% | |
| lapply(function(user){ | |
| after <- "" | |
| df <- list() | |
| for(i in 1: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
| library(tidyverse) | |
| library(lubridate) | |
| library(zoo) | |
| library(scales) | |
| # Read Data --------------------------------------------------------------- | |
| confirmed <- read_csv("https://github.com/nytimes/covid-19-data/raw/master/us-states.csv") |
NewerOlder