Skip to content

Instantly share code, notes, and snippets.

Avatar
💤
#tired

boB Rudis hrbrmstr

💤
#tired
View GitHub Profile
View pmkor-cvt.R
library(stringi)
library(pdftools)
library(tidyverse)
# we're going to process each page and read_fwf will complain violently
# when it hits header/footer rows vs data rows and we rly don't need to
# see all those warnings
read_fwf_q <- quietly(read_fwf)
# grab the PDF text
View five-rounds.csv
sample_id B1 B2 B3 reading_date ward service_line_material
2 8.1 10.8 2.8 aug-15 9 Unknown
4 1.1 BD BD aug-15 1 Copper
7 7.2 1.4 BD aug-15 9 Copper
8 40.6 9.7 6.1 aug-15 9 Lead
12 10.6 1.0 1.3 aug-15 9 Unknown
15 4.4 BD BD aug-15 9 Copper
16 24.4 8.8 4.3 aug-15 5 Galvanized
17 6.6 5.8 1.4 aug-15 2 Unknown
18 4.1 1.1 1.1 aug-15 7 Copper
View title-align.R
library(grid)
library(hrbrthemes)
library(tidyverse)
ggplot(mtcars, aes(wt, mpg)) +
geom_point() +
labs(title = "A Title", subtitle = "A Subtitle") +
theme_ipsum_rc(grid="XY") -> gg
gb <- ggplot_build(gg)
View gitblab-user-prj-pub.R
mkpub <- function(who = "hrbrmstr", prj_name) {
httr::PUT(
url = sprintf("https://gitlab.com/api/v4/projects/%s%%2F%s", who, prj_name),
query = list(
visibility = "public",
private_token = Sys.getenv("GITLAB_PAT")
)
) -> res
httr::content(res, as="parsed")
}
View gh-migrate.r
gh_migrate("YOUR_GITHUB_USERNAME", "GITHUB_REPO")
gitea_user <- function(gitea_username,
api_endpoint = Sys.getenv("GITEA_BASE_URL"),
gitea_token = Sys.getenv("GITEA_PAT")) {
require("httr", quietly = TRUE)
require("jsonlite", quietly = TRUE)
httr::GET(
View viewer-extended.r
options(viewer = function (url, height = NULL, append=FALSE) {
# USE AN ENVIRONMENT SEPARATE FROM GLOBAL BUT ACCESSIBLE
# THIS WILL MAINTAIN CURRENT OUTPUT FILE LOCATION
# IF append IS TRUE THEN INSERT THE NEW HTML AT THE END OF THE FILE
# THERE ARE LOTS OF WAYS TO DO THIS. ONE IS IFRAME-ing EACH AS THEY
# ARE APPENDED. ANOTHER IS TO JUST SMUSH THEM ALL TOGETHER
# MAKE url THE FILE WE JUST MODIFIED
View cran-r-pkgs-system-calls.R
system(paste(".", pathtoms, "ms 10", 1000*numloc, "-t tbs -r tbs tbs -eN tbs tbs -eN tbs tbs < bottpost |", ".", pathtoms, "sample_stats > ss_postb.txt", sep=""))
system(paste(".", pathtoms, "ms 10", formatC(numsim*numloc,digit=7), " -t tbs -r tbs tbs < const |", ".", pathtoms, "sample_stats > afr-const.txt", sep=""))
system(paste(".", pathtoms, "ms 10", formatC(numsim*numloc,digit=7), " -t tbs -r tbs tbs -eN tbs tbs < exp | ", ".", pathtoms, "sample_stats > afr-exp.txt", sep=""))
system(paste(".", pathtoms, "ms 10", formatC(numsim*numloc,digit=7), " -t tbs -r tbs tbs -eN tbs tbs -eN tbs tbs < bott | ", ".", pathtoms, "sample_stats > afr-bott.txt", sep=""))
system(paste("jags ",run.file,sep=""))
system("cmd /c ver",intern=TRUE,invisible=TRUE)
system("uname -rps",intern=TRUE)
system("rm Rlisting001.tmp")
system("rm Rlisting001.tmp")
system("rm Rlisting001.tmp")
View infix_functions.R
`%||%` <- function(a, b) if (is.null(a)) b else a
`%diag*%` <- function(d, X) d * X
`%*diag%` <- function(X, d) t(t(X) * d)
`%nin%` <- function(x, table) !(x %in% table)
`%sub_in%` <- function(x, table) x[x %in% table]
View aa-msp-modules-by-port.r
library(stringi)
library(tidyverse)
list.files("~/Development/metasploit-framework/modules", recursive = TRUE, full.names = TRUE) %>%
map_df(~{
dat <- read_lines(.x)
data_frame(
fil = basename(.x),
contents = list(
dat %>%