This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from typing import Coroutine, List, Sequence | |
def _limit_concurrency( | |
coroutines: Sequence[Coroutine], concurrency: int | |
) -> List[Coroutine]: | |
"""Decorate coroutines to limit concurrency. | |
Enforces a limit on the number of coroutines that can run concurrently in higher |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env Rscript | |
options(dplyr.summarise.inform = F) | |
library(data.table) | |
library(htmlwidgets) | |
library(leaflet) | |
library(tidyverse) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(metR) | |
time <- Sys.time() | |
n <- 50 | |
data <- data.frame( | |
time = seq(time - 3600, time, length.out = n), | |
direction = seq(0, 359, length.out = n), | |
magnitude = 5 * sin(seq(0, 2 * pi, length.out = n)) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import io | |
import pandas as pd | |
api_response_csv = """ | |
x, y, z | |
1, 2, 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
if [[ "$HOSTNAME" == "notchpeak"* ]]; then | |
CLUSTER="np" | |
elif [[ "$HOSTNAME" == "kingspeak"* ]]; then | |
CLUSTER="kp" | |
else | |
echo "Unable to determine cluster from hostname: $HOSTNAME" > /dev/stderr | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env Rscript | |
# Ben Fasoli | benfasoli@gmail.com | |
# Return number of R processes currently running for active user | |
get_process_count <- function(x = NA) { | |
as.integer(system('pgrep -U $USER R | wc -l', intern = T)) | |
} | |
N_FORKS <- 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from datetime import datetime, timedelta | |
from multiprocessing import cpu_count, Pool | |
import os | |
from typing import List | |
from google.cloud import bigquery | |
import pandas as pd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import io | |
import os | |
import subprocess | |
import pandas as pd | |
class ReadTrajException(Exception): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env Rscript | |
library(raster) | |
library(tidyverse) | |
# Time integrate footprints to a single layer | |
r0 <- sum(brick('footprint0.nc')) | |
r1 <- sum(brick('footprint1.nc')) | |
control <- values(r0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
EXE=./hycs_std | |
OUTPUT=PARTICLE.DAT | |
COUNT=0 | |
while ! grep -q NaN $OUTPUT; do | |
$EXE | |
let COUNT=COUNT+1 | |
done |
NewerOlder