Skip to content

Instantly share code, notes, and snippets.

View dalgu90's full-sized avatar

Juyong Kim dalgu90

View GitHub Profile
@dalgu90
dalgu90 / mimic4_analysis_for_icd_coding.ipynb
Created February 7, 2023 17:20
Quick analysis on MIMIC-IV for automatic ICD coding
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dalgu90
dalgu90 / mimic4_split_for_anemic.ipynb
Created February 7, 2023 17:01
MIMIC-IV dataset split for automatic ICD coding
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dalgu90
dalgu90 / magic_wand_opencv.py
Last active August 24, 2022 03:58
Magic wand selection tool with OpenCV Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Magic wand selection with OpenCV Python.
The code highly credits to https://github.com/alkasm/magicwand, but this script only relies on tkinter for user interface.
Please run the code by simply calling: $ python magic_wand_opencv.py
Requirements: Python 3.9+, Pillow, opencv-python>=4.6
"""
import os
@dalgu90
dalgu90 / jupyter-interactive
Last active July 4, 2018 04:56
Preparing for jupyter interactive
# First, you need to install node.js. After you install node.js, type `npm -v` for check
mkdir ~/.local
mkdir ~/node-latest-install
cd ~/node-latest-install
# curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 # For node.js v10.x, there is a hanging issue when installing jupyter-labextension
curl http://nodejs.org/dist/v8.9.0/node-v8.9.0.tar.gz | tar xz --strip-components=1
./configure --prefix=~/.local
make install -j20 # ok, fine, this step probably takes more than 30 seconds...
# curl -k -L https://npmjs.org/install.sh | sh # This doen't need now, since npm is installed together when installing node.js
@dalgu90
dalgu90 / install_vmtouch_local.sh
Created April 16, 2018 05:54
Install vmtouch on local path
#!/bin/sh
PREFIX="$HOME/.local/"
install_vmtouch() {
# The project page of linux "vmtouch" command is located at https://github.com/hoytech/vmtouch
TMP_VMTOUCH_DIR="/tmp/$USER/vmtouch"; mkdir -p $TMP_VMTOUCH_DIR
cd $TMP_VMTOUCH_DIR
git clone https://github.com/hoytech/vmtouch.git
cd vmtouch
@dalgu90
dalgu90 / install_ctags_local.sh
Last active March 22, 2018 06:05
Install linux ctags on local path
#!/bin/sh
PREFIX="$HOME/.local/"
install_ctags() {
# The project page of linux "ctags" command is located at http://ctags.sourceforge.net/
TMP_CTAGS_DIR="/tmp/$USER/ctags"; mkdir -p $TMP_CTAGS_DIR
wget -nc -O $TMP_CTAGS_DIR/ctags.tar.gz "http://prdownloads.sourceforge.net/ctags/ctags-5.8.tar.gz"
tar -xvzf $TMP_CTAGS_DIR/ctags.tar.gz -C $TMP_CTAGS_DIR --strip-components 1
@dalgu90
dalgu90 / install_tree_local.sh
Created February 19, 2018 03:03
Install linux tree command on local path
#!/bin/sh
PREFIX="$HOME/.local/"
install_tree() {
# The project page of linux "tree" command is located at http://mama.indstate.edu/users/ice/tree
TMP_TREE_DIR="/tmp/$USER/tree"; mkdir -p $TMP_TREE_DIR
wget -nc -O $TMP_TREE_DIR/tree.tgz "http://mama.indstate.edu/users/ice/tree/src/tree-1.7.0.tgz"
tar -xvzf $TMP_TREE_DIR/tree.tgz -C $TMP_TREE_DIR --strip-components 1
@dalgu90
dalgu90 / count_ckpt_param.py
Last active September 8, 2022 00:40
Count the number of parameter in a TensorFlow checkpoint file. (Usage: python count_ckpt_param.py path-to-ckpt)
#!/usr/bin/env python
import sys
import tensorflow as tf
import numpy as np
if len(sys.argv) == 2:
ckpt_fpath = sys.argv[1]
else:
print('Usage: python count_ckpt_param.py path-to-ckpt')
@dalgu90
dalgu90 / pdf_even_page.py
Last active August 22, 2022 09:25
Make all PDF files to have even pages, inserting a blank page at the end of each file. PyPDF2 package needed(pip install pypdf2)
#!/bin/usr/env python
# Usage: python pdf_even_page.py
import os
import PyPDF2
import re
def make_even_page(in_fpath, out_fpath):
reader = PyPDF2.PdfFileReader(in_fpath)
@dalgu90
dalgu90 / protomean_to_npy.py
Created August 27, 2016 14:24
convert from proto mean file to npy file
import sys
CAFFE_ROOT = '../../'
sys.path.insert(0, CAFFE_ROOT + 'python/')
import caffe
import numpy as np
if len(sys.argv) != 3:
print "Usage: python protomean_to_npy.py proto.mean out.npy"
sys.exit()