Skip to content

Instantly share code, notes, and snippets.

View hrbrmstr's full-sized avatar
💤
#tired

boB Rudis hrbrmstr

💤
#tired
View GitHub Profile
created_at x event hj_asn hj_prefix hj_name by_asn by_org day
2018-07-09T09:27:23Z BGP HJ AS3491 63.222.5.46/32 PCCW Global, Inc. AS50607 Stowarzyszenie e-Poludnie 2018-07-09
2018-07-09T09:27:20Z BGP HJ AS22414 208.82.237.226/32 Craigslist, Inc. AS50607 Stowarzyszenie e-Poludnie 2018-07-09
2018-07-09T09:27:17Z BGP HJ AS46179 205.196.120.8/32 MediaFire, LLC AS50607 Stowarzyszenie e-Poludnie 2018-07-09
2018-07-09T09:27:15Z BGP HJ AS32934 157.240.1.35/32 Facebook, Inc. AS50607 Stowarzyszenie e-Poludnie 2018-07-09
2018-07-09T08:11:34Z BGP HJ AS41231 91.189.94.16/32 Canonical Group Limited AS50607 Stowarzyszenie e-Poludnie 2018-07-09
2018-07-09T07:42:50Z BGP HJ AS45753 137.59.22.228/32 NETSEC NOC AS50607 Stowarzyszenie e-Poludnie 2018-07-09
2018-07-09T06:28:54Z BGP HJ AS137915 103.87.240.1/32 ZTC-AS-AP Zero Technology Co. ,LIMITED, HK AS50607 Stowarzyszenie e-Poludnie 2018-07-09
2018-07-09T05:02:10Z BGP HJ AS57976 24.105.29.40/32 Blizzard Entertainment, Inc AS50607 Stowarzyszenie e-Poludnie 2018-07-09
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
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
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)
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")
}
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(
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
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")
`%||%` <- 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]