This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
ordinal = lambda n: "%d%s" % (n,"tsnrhtdd"[(math.floor(n/10)%10!=1)*(n%10<4)*n%10::4]) | |
# source: https://stackoverflow.com/questions/9647202/ordinal-numbers-replacement |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from time import sleep | |
import csv | |
def run_driver(path): | |
driver = webdriver.Chrome(path) | |
driver.implicitly_wait(3) | |
return driver | |
def get_site(driver, url): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getArray(s) { | |
var arr = s.split(/(\s+)/).filter((e) => { | |
return e.trim().length > 0; | |
}); | |
return arr; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$(".textarea").off("keyup"); | |
$('.textarea').keyup(function () { | |
// 입력한 값을 구합니다. | |
var input = $(this).val(); | |
// 남은 글자 수를 구합니다. | |
var inputlength = $(this).val().length; | |
// 문서 객체에 입력합니다. | |
$('.length').html(inputlength); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* get_link_for_letter(2019xxxx, YYMMDD, "이름석자"); */ | |
function get_link_for_letter(date_to_enter, date_of_birth, name) { | |
date_to_enter = Base64.encode(date_to_enter + ""); | |
date_of_birth = Base64.encode(date_of_birth + ""); | |
return `http://www.katc.mil.kr/katc/community/children.jsp?search:search_key1:child_search=etc_char8&search:search_key2:child_search=etc_char9&search:search_key3:child_search=etc_char1&search_val1=${date_to_enter}&search_val2=${date_of_birth}&search_val3=${name}` | |
} | |
// Base64 from cms.js from http://www.katc.mil.kr | |
var Base64 = { | |
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%%%% 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)}} |