Skip to content

Instantly share code, notes, and snippets.

View johnnychen94's full-sized avatar
🚀

Johnny Chen johnnychen94

🚀
  • East China Normal University
  • Shanghai, China
View GitHub Profile
@johnnychen94
johnnychen94 / process_watchdog.sh
Created March 5, 2019 03:21
kill all old listed processes
#! /bin/bash
#
# kill all old processes listed in GUARDLIST_PROCESS owned by users listed in GUARDLIST_USER
#
# Usage:
# ./process_watchdog GUARDLIST_USER GUARDLIST_PROCESS WHITELIST_USER WHITELIST_PROCESS
#
# - white list are of highest priority
# - processes owned by users listed in WHITELIST_USER will not be killed
# - process listed in WHITELIST_PROCESS will not be killed
@johnnychen94
johnnychen94 / install_pkgs.jl
Last active July 28, 2019 22:37
Julia Snippets
# add and build julia packages
#
# Usage:
# julia install_pkg.jl filename1 [filenames...]
#
# example of requirement
#
# Images
# IJulia 1.12+
# Flux v"0.6+"
@johnnychen94
johnnychen94 / kill_tensorflow.sh
Last active October 3, 2018 18:15
[kill tensorflow] killall ipykernel processes that occupies GPU memory for a long time
#! /bin/bash
MAX_COUNT=60
COUNT=0
while [ 1 ]
do
FREE=`nvidia-smi -q | grep Free -m 1 | grep -o '[0-9]*'`
GPU=`nvidia-smi -q | grep Gpu -m 1 | grep -o '[0-9]*'`
echo $COUNT/$MAX_COUNT
if [ $FREE -lt 1000 ] && [ $GPU -lt 10 ] ; then