Skip to content

Instantly share code, notes, and snippets.

@selfawaresoup
selfawaresoup / apple-health-to-rda.r
Last active April 7, 2024 10:20
Make Apple Health data available for analysis in R as an RDA file.
# This can take quite a long time to run
library(xml2)
library(tidyverse)
read_xml("apple_health_export/export.xml") -> x
x %>% xml_find_all(".//Record") %>%
xml_attrs %>%
bind_rows %>%

App Install Plan

Critical

@ashiklom
ashiklom / api-ED2.R
Last active January 25, 2021 18:37
PEcAn API minimal example
library(rpecanapi)
library(httr)
library(magrittr, include.only = "%>%")
library(dplyr)
library(glue)
wfmessage <- function(wf) {
message(glue(
"Follow workflow status at:\n",
"http://localhost:8000/pecan/05-running.php?",
@ashiklom
ashiklom / docker-compose.ci.yml
Created January 15, 2020 19:48
GitHub actions + Docker Compose example
# CI overrides
version: '3'
services:
web:
environment:
- DATABASE_URL
- DJANGO_SETTINGS_MODULE
- SECRET_KEY
- PORT
4 medium carrots grated (about 2 cups)
1/2 c walnuts chopped
1 c white flour
1 c wheat flour
1 1/2 tsp. baking soda
2 tsp. baking powder
2 tsp. cinnamon
2 c sugar
4 eggs
3/4 c oil
@ashiklom
ashiklom / docker.org
Created August 21, 2019 15:11
PNNL PEcAn setup

PIC setup notes

VM instance setup

Start at cloud management console (https://dashboard.cloud.pnnl.gov).

Go to “Instances”, then “Launch Instance”.

Details: Give it a name (e.g. “pecan1”) Availability zone “nova” (only option).

@DavisVaughan
DavisVaughan / lm-hell.r
Created May 31, 2019 19:38
Exploring the object size of `lm()` objects with enclosing environments
library(purrr)
library(lobstr)
library(glue)
library(rlang, warn.conflicts = FALSE)
make_an_lm <- function() {
x <- rep(1L, times = 10000000)
cat(glue("x is {object.size(x)}B"))
lm(1 ~ 1)
}
@baptiste
baptiste / balloon.R
Last active November 29, 2017 19:53
library(grImport2)
library(grConvert)
library(egg)
convertPicture("noun_3663.svg", "balloon.svg")
balloon <- readPicture("balloon.svg")
d <- data.frame(x=1:9, y=rnorm(9),
data = I(Map(function(c, s) list(c=c,s=s),c=blues9,s=1:9)),
@noamross
noamross / find_local_tweeps.R
Created August 14, 2017 23:43
A visit to Durham
library(rtweet) #rtweet API creds should already be set up
library(stringi)
library(dplyr)
friends = get_friends(user="noamross")
followers = get_followers("noamross")
tweeps_id = distinct(bind_rows(friends, followers))
tweeps_info = lookup_users(tweeps_id$user_id)
# A regex for a visit to Durham
@magnetikonline
magnetikonline / README.md
Last active June 22, 2024 06:03
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script which will:

  • Iterate all commits made within a Git repository.