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 / 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
@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 / 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 / settings.json
Last active June 24, 2021 20:28
VSCODE configuration
{
"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 / checkout_master.jl
Last active May 9, 2019 13:35
install master branch of julia package
using Pkg.TOML: parsefile
using Pkg
STDLIBS = Set([
"Base64",
"CRC32c",
"Dates",
"DelimitedFiles",
"Distributed",
"FileWatching",
"Future",
@johnnychen94
johnnychen94 / brook.service
Last active September 11, 2019 03:50
brook
[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 / install_conda.sh
Created February 28, 2020 15:32
download&install anaconda
#! /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
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 / diffwarp_simple_rotation.jl
Last active July 30, 2021 11:19
diffwarp: proof of concept on rotation
using ImageTransformations
using StaticArrays
using Interpolations
using ImageCore
using ImageShow
using TestImages
using ChainRules
using ChainRules: NoTangent, ZeroTangent, @not_implemented
using ChainRulesTestUtils
using Zygote
@johnnychen94
johnnychen94 / macos_unicode_lookup.md
Created August 24, 2021 08:27
macOS keyboard quick lookup for Julia unicode symbols

macOS keyboard quick lookup for Julia unicode symbols

Check Julia Unicode Input for complete reference.

Code point(s) Character(s) Tab completion sequence(s) macOS keyboard
U+2211 \sum Opt-w
U+00F8 ø \o Opt-o
U+03C0 π \pi Opt-p
U+00E5 å \aa (a\ocirc) Opt-a