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
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):
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
@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)}}
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
# https://github.com/golbin/TensorFlow-Tutorials/blob/master/06%20-%20MNIST/01%20-%20MNIST.py
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("./mnist/data/", one_hot=True)
X = tf.placeholder(tf.float32, [None, 784])
Y = tf.placeholder(tf.float32, [None, 10])
from utils import *
params = {}
def create_variable(scope, name, shape, trainable=True, on_cpu=True, **kwargs) -> tf.Variable:
def _create_variable():
with tf.variable_scope(scope):
_w = tf.get_variable(name, shape, trainable=trainable, **kwargs)
params[_w.name] = _w