Skip to content

Instantly share code, notes, and snippets.

@marcusrussi
marcusrussi / harvard-cluster-nextflow-covidestim-install.sh
Last active May 27, 2021 22:15
Install Nextflow on Harvard cluster and do a test run
cd ~
# Get an interactive session. --mem is important otherwise
# you will probably get "OOM-killed" later on
srun --pty -p test --mem=4G --time=120 bash
# Load Java and Conda
module load jdk/1.8.0_172-fasrc01 # This MIGHT not be neccessary, but doesn't hurt..
module load Anaconda3/2019.10
@marcusrussi
marcusrussi / nyc_age_distribution_estimates.csv
Created March 17, 2020 15:17
Sourced from pages 31-42 of New York City Population Projections by Age/Sex & Borough, 2010-2040 (https://www1.nyc.gov/assets/planning/download/pdf/data-maps/nyc-population/projections_report_2010_2040.pdf)
borough age 2010 2015 2020 2025 2030 2035 2040
bronx 0-4 103144 106770 109972 111127 110880 110982 112571
bronx 5-9 98664 102008 105775 109843 111137 110893 110942
bronx 10-14 99159 92423 95703 100081 104065 105297 105010
bronx 15-19 115662 105751 98987 103114 107753 111879 113100
bronx 20-24 112897 124181 113827 107423 111941 116901 121256
bronx 25-29 105710 115853 127995 117887 111171 116011 121249
bronx 30-34 97824 99969 109797 122434 112812 106338 110963
bronx 35-39 91016 91397 93530 103582 115705 106610 100424
bronx 40-44 96073 86719 87217 89976 99685 111331 102576
// this sketch was brutally hacked together by TJ Bruno --- https://medium.com/@tbruno25
#include <mcp_can.h>
#include <SPI.h>
unsigned long int rxId;
unsigned char len = 0;
unsigned char rxBuf[8];
bool displayOnce;
@marcusrussi
marcusrussi / trapps_routes.tsv
Last active December 3, 2019 04:49
A list of rock climbing routes in The Trapps, Gardiner, NY. Note: 999999 means unsorted within the most local area. Otherwise, the cliff is sorted L->R
Key Stars Grade Name
0 ★ ½ 5.2 Cordelette Arete
1 ★ ½ 5.3 Short and Simple
2 5.9 Birthday Biscuit Boy
3 ★ ★ 5.7+ Keyhole
4 ★ ★ 5.7 Katzenjammer
5 ★ ★ 5.7 Brat, The
6 ★ ★ 5.7 Handy Andy
7 ★ ½ 5.3 Easy Keyhole
8 ★ ★ 5.5 Black Fly
N_JOBS=10 # number of jobs to run in parallel
FOLDER='exp3' # where the results should be stored
RESULT_FILE='results_top10.csv' # cols should be [run.id, seed, density, lk] (no header)
parallel -j $N_JOBS --csv \
mkdir $FOLDER/{1} '&&' \
srun -p interactive -N1 -n1 --time=10 \
TBABM -t1 \
-n30000 \
-p {1}.json \
@marcusrussi
marcusrussi / less_print.less
Created September 25, 2019 19:55
Print, with color, from Less
(from document start)
|$ aha | wkhtmltopdf -s letter - fname.pdf
or
|$ aha | wkhtmltopdf -s letter - - | lp
@marcusrussi
marcusrussi / gist:4d5c0f9d129d2cd4cce40ec962cca0bf
Last active September 24, 2019 15:14
Generate a list of 64-bit integers, one per line
#!/usr/bin/env/bash
NUM_INTS=100
NUM_BYTES=$((8*NUM_INTS))
head -c $NUM_BYTES /dev/urandom |
od -t u8 -An -w8 | # Request 8-bit unsigned integers, no radix, 8 bits per line
sed 's/ //g' | # Replace any spaces with nothing
TOKEN='ATreGoqkKeGhBrqAHVbNNTychduhSkdg'
TWEED='USW00014758'
# Print header, then pull daily weather summary from Tweed's station
echo 'date,daily_hi' &&
curl -sGH "token:$TOKEN" \
-d "stationid=GHCND:$TWEED" \
-d 'datasetid=GHCND' \
-d 'startdate=2019-09-10' \
-d 'enddate=2020-01-15' \
requireNamespace("tibble")
requireNamespace("dplyr")
requireNamespace("purrr")
# Tallies up the quantity of every distinct value in every variable in
# a tibble, returning output as a list indexed on varible name.
#
# tbl -> list of {varname: {value, n}}
# tbl: an ungrouped tibble
# list: each element is a 2-element list. The first element
#!/usr/bin/env bash
DEFAULT_TR_URL="https://cascadeclimbers.com/forum/topic/100929-tr-baker-river-to-ross-lake-in-technicolor-mystery-ndespair-pioneer-swiss-spectre-challenger-7252017/"
# url for a TR -> broken urls of photos in OP
function original_photo_urls () {
curl -s $1 |
# All of the broken photo urls appear to contain 'plab/data/5'
# as a substring
egrep 'plab/data/5' |