Skip to content

Instantly share code, notes, and snippets.

@aaronwolen
aaronwolen / retrieve-aws-credentials.py
Created March 9, 2022 20:24
retrieve-aws-credentials
# access aws credentials for a profile from ~/.aws/credentials
import boto3
profile = 'default'
session = boto3.Session(profile_name=profile)
credentials = session.get_credentials()
credentials.access_key
credentials.secret_key
@aaronwolen
aaronwolen / setup-ebs.sh
Last active November 25, 2021 13:24
Setup EBS Raid on EC2 Linux Instance
#!/usr/bin/env bash
# format
sudo mkfs -t ext4 /dev/nvme1n1
# mount ebs volumne
sudo mkdir -p /mnt/data
sudo mount /dev/nvme1n1 /mnt/data
# fix permissions
@aaronwolen
aaronwolen / find-and-rename.sh
Created September 29, 2021 19:11
Find and rename files
while read line; do
mv -v "$line" "${line// - /}"
done < <(find . -name '* .png')
@aaronwolen
aaronwolen / Makefile
Created July 15, 2021 20:07
Modify ClinVar VCF for ingestion into TileDB-VCF
# genome reference
fai_url := s3://broad-references/hg38/v0/Homo_sapiens_assembly38.fasta.fai
fai_file := $(notdir $(fai_url))
# original clinvar vcf
vcf_url := ftp.ncbi.nlm.nih.gov/pub/clinvar/vcf_GRCh38/clinvar_20210710.vcf.gz
raw_vcf := $(notdir $(vcf_url))
# modified vcf file
mod_vcf := $(raw_vcf:%.vcf.gz=%_modified.vcf.gz)
@aaronwolen
aaronwolen / osfr-wiki-download.R
Created June 22, 2021 16:18
Use osfr to download individual OSF Wikis
library(osfr)
library(purrr)
library(tibble)
# functions ---------------------------------------------------------------
# id: project GUID
.osf_list_wikis <- function(id) {
api_path <- sprintf("nodes/%s/wikis", id)
@aaronwolen
aaronwolen / sample_fastq.py
Created September 3, 2012 17:38
Random sample of fastq sequences from paired-end files
# Code written by brentp in response to BioStars question:
# http://www.biostars.org/post/show/6544/
import random
import sys
def write_random_records(fqa, fqb, N=100000):
""" get N random headers from a fastq file without reading the
whole thing into memory"""
records = sum(1 for _ in open(fqa)) / 4
@aaronwolen
aaronwolen / calendarHeat.R
Last active October 26, 2020 21:30
Calendar Heatmap by Paul Bleicher
##############################################################################
# Calendar Heatmap #
# by #
# Paul Bleicher #
# an R version of a graphic from: #
# http://stat-computing.org/dataexpo/2009/posters/wicklin-allison.pdf #
# requires lattice, chron, grid packages #
##############################################################################
## calendarHeat: An R function to display time-series data as a calendar heatmap
@aaronwolen
aaronwolen / tiledbvcf-ingest-export-test.sh
Last active October 21, 2020 17:19
Shell script to run ingest/exports with different versions of tiledb-vcf
#!/usr/bin/env bash
# variables
#############
tilevcf="dist/bin/tiledbvcf"
tmpdir="/mnt/data/tmp"
samplefile="$tmpdir/samples.txt"
output_dir="data"
export_dir="$output_dir/exports"
@aaronwolen
aaronwolen / door-notification.yaml
Last active July 25, 2020 18:38
HASS Door Notification
- alias: Announce Door Open
trigger:
- platform: state
entity_id:
- binary_sensor.back_door
- binary_sensor.front_door
to: 'on'
for:
seconds: 30
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.