Skip to content

Instantly share code, notes, and snippets.

Avatar
💤
#tired

boB Rudis hrbrmstr

💤
#tired
View GitHub Profile
@hrbrmstr
hrbrmstr / dockerfile.md
Created Dec 12, 2020 — forked from kevwan/dockerfile.md
The simplest way to write Dockerfile!
View dockerfile.md

1. choose a simple linux image

For example alpine, it's only about 5MB.

2. set timezone if necessary

RUN apk add --no-cache tzdata
ENV TZ America/New_York
@hrbrmstr
hrbrmstr / phantomjs.R
Created Dec 29, 2014
Scraping gnarly sites with phantomjs & rvest
View phantomjs.R
library(rvest)
# example of using phantomjs for scraping sites that use a twisty maze
# of javascript to render HTML tables or other tags
# grab phantomjs binaries from here: http://phantomjs.org/
# and stick it somehere PATH will find it
# this example scrapes the user table from:
@hrbrmstr
hrbrmstr / do_rpt.r
Last active Oct 22, 2020
parallel, parameterized knitr reports
View do_rpt.r
library(doParallel)
rpts <- list(list(out="one.html", params=list(some_var="One")),
list(out="two.html", params=list(some_var="Two")),
list(out="three.html", params=list(some_var="Three")),
list(out="four.html", params=list(some_var="Four")))
do_rpt <- function(r) {
require(rmarkdown)
@hrbrmstr
hrbrmstr / app.R
Created Jan 23, 2017 — forked from leonawicz/app.R
Use custom local image files as icons in a Shiny Dashboard value box
View app.R
#
# This Shiny web application demonstrates the use of custom image files
# in place of icons for value boxes in Shiny Dashboard by overriding two
# functions:
#
# 'icon' from the shiny package and 'valueBox' from the shinydashboard package.
#
# Each function adds minimal, specific additional handling of image files.
# Note: A custom css file must also be included so that value boxes can
# display the icons. For that reason, do not expect images in place of icons to
@hrbrmstr
hrbrmstr / gg_tweet.R
Last active Oct 16, 2020
use the magick device to make ggplots conform to twitter card or in-stream image optimal sizes, with or without "retina" resolution
View gg_tweet.R
library(httr)
library(magick)
library(hrbrthemes)
library(ggplot2)
theme_tweet_rc <- function(grid = "XY", style = c("stream", "card"), retina=TRUE) {
style <- match.arg(tolower(style), c("stream", "card"))
switch(
View continents.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View xpath-cheatsheet.js
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
View asia.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hrbrmstr
hrbrmstr / find_emoji.r
Created Oct 24, 2017
find and extract emoji in R
View find_emoji.r
# save this to '_chat.txt` (it require a login)
# https://www.kaggle.com/sarthaknautiyal/whatsappsample
library(ore)
library(dplyr)
emoji_src <- "https://raw.githubusercontent.com/laurenancona/twimoji/gh-pages/twitterEmojiProject/emoticon_conversion_noGraphic.csv"
emoji_fil <- basename(emoji_src)
if (!file.exists(emoji_fil)) download.file(emoji_src, emoji_fil)
@hrbrmstr
hrbrmstr / robotstxt.csv
Created Aug 1, 2017
robots.txt user agent strings from June 2017 robots.txt Common Crawl
View robotstxt.csv
useragent n
* 494648
IRLbot 378368
bingbot 100948
MJ12bot 94377
msnbot 66142
AhrefsBot 51999
Yandex 50260
Slurp 49160
SemrushBot 45041
You can’t perform that action at this time.