Skip to content

Instantly share code, notes, and snippets.

View kiendang's full-sized avatar
🐶

Kien Dang kiendang

🐶
View GitHub Profile
#!/bin/bash
#
# auto match window title and tab background color with
# terminal background color for iTerm2
# append to your .bashrc, .zshrc or whatever
# does not really work with High Sierra
# to reset:
# echo -e "\033]6;1;bg;*;default\a"
osascript -e \
---
output: html_document
editor_options:
chunk_output_type: inline
---
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.7.1
@kiendang
kiendang / unzip_into_dir.sh
Last active February 11, 2019 10:48
unzip all .zip files into directories
#!/bin/bash
find ${1:-.} -name '*.zip' | sed 's/.zip//' | xargs -n1 -P $(nproc) -I _ unzip _.zip -d _
channels:
- defaults
- pytorch
- fastai
dependencies:
- pip
- ipykernel
- pytorch::pytorch
- pytorch::torchvision
- tensorflow-gpu
-- Functions TODO:
-- FROM table CROSS JOIN UNNEST(table.column) AS col -> ???? (see icustay-hours)
-- ???(column) -> PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY column) (not sure how to do median in BQ)
-- psql 'dbname=mimiciv user=mimic options=--search_path=public,mimic_core,mimic_hosp,mimic_icu,mimic_derived' -f postgres-functions.sql
DROP FUNCTION IF EXISTS REGEXP_EXTRACT(str TEXT, pattern TEXT);
CREATE OR REPLACE FUNCTION REGEXP_EXTRACT(str TEXT, pattern TEXT) RETURNS TEXT AS $$
BEGIN
RETURN substring(str from pattern);
# This file makes tables for the concepts in this subfolder.
# Be sure to run postgres-functions.sql first, as the concepts rely on those function definitions.
# Note that this may take a large amount of time and hard drive space.
# string replacements are necessary for some queries
export REGEX_DATETIME_DIFF="s/DATETIME_DIFF\((.+?),\s?(.+?),\s?(DAY|MINUTE|SECOND|HOUR|YEAR)\)/DATETIME_DIFF(\1, \2, '\3')/g"
export REGEX_SCHEMA='s/`physionet-data.(mimic_derived|mimic_core|mimic_hosp|mimic_icu).(.+?)`/\2/g'
export CONNSTR='mimiciv mimic'
# this is set as the search_path variable for psql