Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀

Johnny Chen johnnychen94

🚀
View GitHub Profile
View pkgserver_watchdog.jl
using Pkg
using Dates
### BEGIN Setup ###
const pkg_servers = [
"https://cn-east.pkg.julialang.org",
"https://kr.pkg.julialang.org",
"https://us-east.pkg.julialang.org",
"https://kr.storage.julialang.org",
"https://us-east.storage.julialang.org",
@johnnychen94
johnnychen94 / install_conda.sh
Created Feb 28, 2020
download&install anaconda
View install_conda.sh
#! /bin/bash
# 设置版本及下载源
CONDA_VERSION=2019.10
CONDA_NAME=Anaconda3-${CONDA_VERSION}-Linux-x86_64.sh
CONDA_URL=https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/$CONDA_NAME
# 下载并安装anaconda
echo "Download anaconda from ${CONDA_URL}"
curl -O $CONDA_URL
View brook.service
[Unit]
Description=Brook service
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/brook client -l 127.0.0.1:8080 -i 127.0.0.1 -s vpn.lflab.cn:8989 -p ecnumath --http >> /dev/null 2>&1
Restart=on-failure
[Install]
@johnnychen94
johnnychen94 / checkout_master.jl
Last active May 9, 2019
install master branch of julia package
View checkout_master.jl
using Pkg.TOML: parsefile
using Pkg
STDLIBS = Set([
"Base64",
"CRC32c",
"Dates",
"DelimitedFiles",
"Distributed",
"FileWatching",
"Future",
@johnnychen94
johnnychen94 / settings.json
Last active Apr 15, 2019
VSCODE configuration
View settings.json
{
"explorer.confirmDelete": false,
"explorer.confirmDragAndDrop": false,
"editor.cursorStyle": "block",
"editor.detectIndentation": false,
"editor.formatOnPaste": true,
"editor.formatOnType": true,
"editor.fontSize": 13,
"editor.wordWrap": "wordWrapColumn",
"editor.wordWrapColumn": 90,
@johnnychen94
johnnychen94 / process_watchdog.sh
Created Mar 5, 2019
kill all old listed processes
View process_watchdog.sh
#! /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
View install_pkgs.jl
# 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 Oct 3, 2018
[kill tensorflow] killall ipykernel processes that occupies GPU memory for a long time
View kill_tensorflow.sh
#! /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