Skip to content

Instantly share code, notes, and snippets.

View dpastoor's full-sized avatar

Devin Pastoor dpastoor

  • A2-Ai
  • Rockville, MD
View GitHub Profile
# from https://medium.com/@sidneyliebrand/how-fzf-and-ripgrep-improved-my-workflow-61c7ca212861
function fp --description 'Search your $PATH'
set -l loc (echo $PATH | tr ' ' '\n' | eval "fzf $FZF_DEFAULT_OPTS --header='[find:path]'")
if test (count $loc) = 1
set -l cmd (rg --files -L $loc | rev | cut -d'/' -f1 | rev | tr ' ' '\n' | eval "fzf $FZF_DEFAULT_OPTS --header='[find:exe] => $loc'")
if test (count $cmd) = 1
echo $cmd
else
fp
@dpastoor
dpastoor / pkgr.yml
Last active April 1, 2019 01:09
pkgr yml file
Version: 1
Packages:
- shinycssloaders
- furrr
- TrialSize
- PropCIs
- profvis
- DiagrammeR
- DiagrammeRsvg
- devtools
BASE_DIR="$HOME/.vim"
PLUGIN_DIR="$BASE_DIR/bundle"
COLORS_DIR="$BASE_DIR/colors"
AUTOLOAD_DIR="$BASE_DIR/autoload"
PLUGINS=(
"kien/ctrlp.vim"
"vim-airline/vim-airline"
"vim-airline/vim-airline-themes"
"scrooloose/nerdtree"
curl -L https://get.oh-my.fish | fish
omf install sushi
# copy fish config
fundle install 'nesl247/fish-theme-dracula'
https://github.com/moncho/dry
repo_create <- try(gh::gh("POST /user/repos",
name = repo_nm,
description = paste("Website for workshop", repo_nm)),
silent = TRUE)
if (inherits(repo_create, "try-error")) {
stop("Can't create repository. Does it already exist?")
} else if (inherits(repo_create, "gh_response")) {
if (identical(attr(repo_create, "response")$status,
"201 Created"))
message("repo created")
@dpastoor
dpastoor / rstudio_type.R
Last active February 25, 2018 18:21
rstudio type
rstudio_type = function(x, pause = function() .1, mistake = 0, save = 0) {
get_ctx = function() rstudioapi::getSourceEditorContext()
ctx = get_ctx()
if (is.null(id <- ctx$id)) {
message('Please make sure an RStudio editor tab is open')
return()
}
save_it = function(prob = 1) {
if (ctx$path == '' || (rbinom(1, 1, prob) == 0)) return()
install_location <- .libPaths()[[2]]
pkgs <- c(
"RcppTOML",
"anytime",
"styler",
"sinew",
"shinyjs",
"diffr",
"data.table",
// This code is published under GNU GPL v3+. For more information, visit http://www.gnu.org/licenses/gpl.html
package main
import (
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"os"