Skip to content

Instantly share code, notes, and snippets.

View dongkwan-kim's full-sized avatar
🎯
Focusing

Dongkwan Kim dongkwan-kim

🎯
Focusing
View GitHub Profile
@dongkwan-kim
dongkwan-kim / nvidia_docker_setup.sh
Last active August 7, 2024 03:40
nvidia docker setup in remote server accessible by ssh
# In the server, (images what I mostly used)
docker pull nvidia/cuda:11.1.1-cudnn8-devel-ubuntu20.04
# cuda 10.0 multiple ports volume binding
docker run -ti --runtime=nvidia --name dongkwan -p 8082:22 -p 8083:6006 --ipc=host -v /mnt/nas2:/mnt/nas2 -d nvidia/cuda:11.1.1-cudnn8-devel-ubuntu20.04 /bin/bash
# Unknown runtime specified nvidia
docker run -ti --gpus '"device=0,1,2,3"' --name dongkwan -p 8070:22 --ipc=host -d nvidia/cuda:10.0-cudnn7-devel-ubuntu16.04 /bin/bash
# For volume
docker volume create volume_name
sudo apt update
sudo apt install -y build-essential zlib1g-dev libssl-dev
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz
tar -xvf openssh-9.8p1.tar.gz
cd openssh-9.8p1
./configure
make
import random
T = 596
R, C = 37, 16
numbers = list(range(1, T + 1))
random.shuffle(numbers)
sets = []
for _set in range(R):
@dongkwan-kim
dongkwan-kim / toCamel.sh
Created April 29, 2017 16:05
shell script to change snake_case to camelCase
#! /bin/bash
# usage bash toCamel.sh target.js
# snake_func -> snakeFunc
for i in $(seq 1 30)
do
cat $1 | sed -r 's/([a-z]+)_([a-z])([a-z]+)/\1\U\2\L\3/g' > temp
mv temp $1
done
from typing import Tuple, List
try:
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator
from mpl_toolkits.mplot3d import Axes3D
except ImportError:
pass
import numpy as np
nvidia-smi --query-compute-apps=pid,process_name,used_memory --format=csv
ps all --sort=-time | grep python
python -u analysis.py | tee log.txt
ps aux | grep -ie "query" | awk '{print $2}' | xargs kill -9
@dongkwan-kim
dongkwan-kim / latex_patterns.tex
Created October 4, 2021 08:51
My LaTeX patterns
\newcommand\todo[1]{\textcolor{red}{#1}}
\newcommand\g[1]{\textcolor{gray}{#1}}
\newcommand*{\scale}[2][4]{\scalebox{#1}{$#2$}}%
\newcommand*{\resize}[2]{\resizebox{#1}{!}{$#2$}}%
\newcommand\ko[1]{
\begin{CJK}{UTF8}{} % require \usepackage{CJKutf8}
\CJKfamily{mj}
#1
\end{CJK}
}
from typing import Dict, Any, List, Tuple
import torch
from torch import Tensor
def auto_index_select(value_tensor: Tensor, index_tensor: Tensor):
index_tensor = index_tensor.squeeze()
sizes = value_tensor.size()
for dim, dim_size in enumerate(sizes):
%%%%% NEW MATH DEFINITIONS %%%%%
\usepackage{amsmath,amsfonts,bm}
% Mark sections of captions for referring to divisions of figures
\newcommand{\figleft}{{\em (Left)}}
\newcommand{\figcenter}{{\em (Center)}}
\newcommand{\figright}{{\em (Right)}}
\newcommand{\figtop}{{\em (Top)}}
\newcommand{\figbottom}{{\em (Bottom)}}