I hereby claim:
- I am mkearney on github.
- I am kearneymw (https://keybase.io/kearneymw) on keybase.
- I have a public key ASAprxnmWoBc1OCGFVW6Lid1F4IXNx6uabYjq-hOiDx_hQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
## install packages (from CRAN) if not already | |
pkgs <- c("dplyr", "rtweet", "ggplot2", "syuzhet", "ggbeeswarm", "remotes") | |
if (any(!pkgs %in% installed.packages())) { | |
install.packages(pkgs[!pkgs %in% installed.packages()]) | |
} | |
## install {dataviz} theme from github | |
remotes::install_github("mkearney/dataviz") | |
## define paste function I really like rn |
## install {remotes} pkg | |
if (!requireNamespace("remotes", quietly = TRUE)) { | |
install.packages("remotes") | |
} | |
## install {tfse} from github | |
remotes::install_github("mkearney/tfse") | |
## load {tfse} | |
library(tfse) |
bytes2char <- function(x) { | |
m <- gregexpr("<[[:alnum:]]{2}>", x) | |
y <- regmatches(x, m)[[1]] | |
y <- gsub("^<|>$", "", y) | |
y <- strsplit(y, "[><]+") | |
regmatches(x, m) <- list(sapply(y, function(.x) rawToChar(as.raw(paste0("0x", .x))))) | |
x | |
} | |
## read in string with bytes |
-- 1. Place in ~/Library/Scripts and enable the Applescript menu via the Applescript Editor | |
-- 2. Substitute "vpn.example.com" and "redacted" for your VPN server and password | |
-- 3. Open Security & Privacy System Preferences, go to Privacy, Accessibility | |
-- 4. Enable Applescript Editor and System UI Server | |
-- 5. Trigger script from the menu | |
-- 6. Enjoy being connected | |
tell application "Cisco AnyConnect Secure Mobility Client" | |
activate | |
end tell |
## load rtweet and congress116 | |
library(rtweet) | |
library(congress116) | |
## create long-version of congress116 data (and drop rows w/o screen names) | |
sns <- with(congress116, data.frame( | |
bioguide = c(bioguide, bioguide[!is.na(screen_name_personal)]), | |
handle = c(screen_name_official, screen_name_personal[!is.na(screen_name_personal)]), | |
stringsAsFactors = FALSE | |
)) |
#!/usr/bin/env Rscript | |
##keynote.R v1.0 Damon Kiesow @dkiesow | |
##Use with the Keynote rTweet AppleScript app to automate threaded tweeting during Keynote presentations | |
## | |
## load rtweet package | |
library(rtweet) | |
me <- rtweet:::home_user() | |
## Pull parameters from command line (first_status will be "yes" or "no" and provided from the AppleScript) | |
args <- commandArgs(trailingOnly = TRUE) |
library(rtweet) | |
## number of iterations | |
n <- 5 | |
## to do a certain task (e.g., searching for tweets on a topic), | |
## twitter policy says you should use one token | |
## so select one token | |
token <- get_tokens() | |
if (!"Token" %in% class(token)) { |
## load rtweet | |
library(rtweet) | |
## store bounding box coordinates for state of nevada | |
nv <- c(-120.00647, 35.00186, -114.03965, 42.00221) | |
## initialize output vector and Midwestern 'ope' counter | |
s <- list() | |
ope <- 0L |
## install these if not already | |
pkgs <- c("remotes", "syuzhet", "tfse", "rtweet", "ggplot2", "dplyr", "tidyr") | |
if (length(pkgs <- pkgs[!pkgs %in% installed.packages("remotes")]) > 0) { | |
install.packages(pkgs) | |
} | |
## install from github | |
remotes::install_github("mkearney/dataviz") | |
remotes::install_github("mkearney/dict") |