Skip to content

Instantly share code, notes, and snippets.

View jdblischak's full-sized avatar

John Blischak jdblischak

View GitHub Profile
@pat-s
pat-s / addins.json
Last active March 2, 2020 09:58
Apply RStudio Desktop Settings
{
"styler::style_active_file": "Ctrl+Y",
"addmins::insert_dashes": "Ctrl+8",
"xaringan::inf_mr": "Ctrl+M",
"drake::rs_addin_loadd": "Ctrl+K",
"browse::browse": "Ctrl+B"
}
@wolfv
wolfv / run_conda_builds.py
Created July 28, 2019 18:13
Run many conda builds in parallel, as fast as possible.
from pathlib import Path
import jinja2
import yaml
from conda.models.match_spec import MatchSpec
import networkx as nx
# import matplotlib.pyplot as plt
import os, random, time, json
import workerpool
NO_BUILD_LOCAL_PKGS = True
@isteves
isteves / tidyselect.md
Last active May 4, 2020 15:28
Trying to grok tidyselect

Trying to grok tidyselect

Key takeaways:

  • everything inside vars(...) is exactly the same as the stuff inside select(...)!!!
  • vars() is used for all scoped variants of dplyr verbs (I assume bc the variables need to “fit” into a single argument, .vars. In select(...), the ellipses take everything)
  • vars_select() is probably more of a developer-facing function (seen in select_helpers documentation)

Some "gotchas":

@eliocamp
eliocamp / tweet_storm.R
Last active December 3, 2024 23:01
Example of posting a twitter thread from R
---
title: "Tweet thread"
author: "Elio Campitelli"
output: github_document
---
```{r}
knitr::opts_chunk$set(dev = "png",
tweet_this = TRUE)
@arigesher
arigesher / trigger_build.bash
Created May 22, 2019 18:42
CircleCI manual trigger
#!/bin/bash -e
# Usage:
#
# 1. set $CIRCLE_API_TOKEN
# 2. run `./trigger-build <account> <oroject> [<branch>]`
#
# For https://github.com/iambob/myfirstproject:
#
# trigger_build iambob myfirstproject
@simecek
simecek / valentine.py.R
Created February 14, 2019 21:00
R/Python Valentine Script
s = 'Python is awesome!'
red = "#FA5882"
a = eval("exec('import sys; import matplotlib.pyplot as plt; import numpy as np; print(s); t = np.arange(0,2*np.pi, 0.1); x = 16*np.sin(t)**3; y = 13*np.cos(t)-5*np.cos(2*t)-2*np.cos(3*t)-np.cos(4*t); plt.fill(x,y,color=red); plt.show(); sys.exit()')")
print('R is great too!')
X11() # Use windows() or qartz() if on Windows or Mac
t = seq(0, 2*pi, by=0.1)
x = 16*sin(t)^3
y = 13*cos(t) - 5*cos(2*t) - 2*cos(3*t) - cos(4*t)
plot(x=x, y=y, type="n", xlab="", ylab="")
polygon(x=x, y=y, col=red, border=red)
@maelle
maelle / java.R
Created July 25, 2018 07:15
Tell me which R packages have a Java dependency https://twitter.com/mattmoehr/status/1021979537905790982
``` r
cran_db <- tools::CRAN_package_db()
cran_db <- cran_db[, c("Package", "SystemRequirements",
"Imports", "Depends", "Suggests")]
java <- dplyr::filter(cran_db,
stringr::str_detect(Imports, "rJava") |
stringr::str_detect(Imports, "rJava") |
stringr::str_detect(Depends, "rJava")|
stringr::str_detect(SystemRequirements, "[Jj]ava"))
#!/bin/bash
TODAY=`date +%Y-%m-%d`
TODAY_MD=`date +%B\ %d,\ %Y`
YEAR=`date +%Y`
PACKAGENAME=$1
##
## CHANGE ME!!!
@slowkow
slowkow / get_snp_proxies.ipynb
Last active August 9, 2022 00:44
Find SNP proxies in R
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DarwinAwardWinner
DarwinAwardWinner / analyze_pkg_usage.R
Last active February 12, 2025 16:27
Script for finding loaded but unused packages in R scripts
#!/usr/bin/env Rscript
suppressPackageStartupMessages({
library(globals)
library(readr)
library(stringr)
library(rex)
library(magrittr)
library(rlang)
library(knitr)