Skip to content

Instantly share code, notes, and snippets.

@npjc
Created May 28, 2015 03:53
Show Gist options
  • Save npjc/49eaac70baa6dc30f993 to your computer and use it in GitHub Desktop.
Save npjc/49eaac70baa6dc30f993 to your computer and use it in GitHub Desktop.
what short github alphanumeric only names aren't taken
library(httr)
library(dplyr)
url <- "https://www.github.com"
# all possible alpha numeric names
allowed_n_letters <- 1:3 # just change this to check others...
possible_paths <- lapply(allowed_n_letters,function(x) {
combn(letters, x) %>% apply(2, paste0, collapse="")
}) %>% unlist()
# receiving vector
out <- vector("list", length(possible_paths))
# walk through all the requests. if staus is 200 it exists; if 404 it doesn't
for(i in seq_along(possible_paths)) {
r <- GET(url,path = possible_paths[i])
out[[i]] <- dplyr::data_frame(request_path = possible_paths[i],
status_code = status_code(r))
}
res <- dplyr::bind_rows(out) %>%
filter(status_code != 200)
res %>%
readr::write_tsv("one_two_threes.tsv")
request_path status_code
w 404
ahq 404
any 404
aqy 404
bhq 404
bhv 404
bkq 404
bqv 404
bqy 404
bvy 404
cfl 404
cqx 404
dfq 404
dgu 404
dkq 404
dnt 404
dqv 404
efq 404
egq 404
egz 404
ehu 404
eiy 404
ejx 404
eou 404
eqv 404
fgz 404
fqw 404
fvx 404
fvy 404
fvz 404
gij 404
gjq 404
glq 404
gnq 404
gqr 404
gqt 404
gqv 404
gqz 404
gvw 404
gvy 404
hjv 404
hnv 404
hqv 404
hty 404
ijq 404
ijx 404
ikq 404
ikx 404
ipz 404
iqy 404
iuw 404
ivx 404
jkt 404
jqv 404
kqt 404
lnq 404
lru 404
mnq 404
mqw 404
nqw 404
oqs 404
oqu 404
oqw 404
oqx 404
oqz 404
ouw 404
ovw 404
puv 404
qrv 404
qsw 404
qtu 404
quv 404
quw 404
qvy 404
tvy 404
uvz 404
uwz 404
uxz 404
vwz 404
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment