This file contains 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 tensorflow as tf | |
AUTOTUNE = tf.data.experimental.AUTOTUNE | |
import pathlib | |
import random | |
import os | |
import IPython.display as display | |
import matplotlib.pyplot as plt | |
This file contains 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
export PWD=`pwd` | |
export DIR=. | |
export FILENAME=main | |
# =========================================== | |
en: ## compile LaTeX with English | |
@make tex CONTAINER=pman0214/alpine-texlive-ja-epspdf | |
@make aux CONTAINER=pman0214/alpine-texlive-ja-epspdf | |
@make tex CONTAINER=pman0214/alpine-texlive-ja-epspdf | |
@make tex CONTAINER=pman0214/alpine-texlive-ja-epspdf | |
@make dvi CONTAINER=pman0214/alpine-texlive-ja-epspdf |
This file contains 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
## ENVs | |
# basic | |
export PWD=`pwd` | |
# docker | |
export CONTAINER_NAME=container_name | |
export DIR_DOCKER=docker | |
export DOCKERFILE_NAME=Dockerfile | |
export EXPOSED_PORT=8888 | |
export CONTAINER_ID=`docker ps --format {{.ID}}` | |
# -------------------------------------------------------- |
This file contains 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
# initialize | |
ip link | |
sudo su | |
apt update | |
apt upgrade -y | |
apt install -y openssh-server vim | |
# method-1 | |
sudo service network-manager stop | |
sudo update-rc.d -f network-manager remove |
This file contains 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
""" | |
Before running this cell, you will set hidden vars by "add-ons" menu. | |
""" | |
from kaggle_secrets import UserSecretsClient | |
def clone_repository( | |
ssh_keyval: "str: BEGIN RSA PRIVATE KEY to END RSA PRIVATE KEY" | |
, ssh_keyname: "str: id_rsa..." | |
, gitrepo: "str: your private repository to clone" |
This file contains 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
# curl -O https://gist.githubusercontent.com/xagano/1ba3caabd6d1c40d0fe85058a7294222/raw/b2ea3934cfeec110aaf74ca8f5bbdd07fae628fe/TF2_MNIST.py | |
import time | |
import tensorflow as tf | |
mnist = tf.keras.datasets.mnist | |
(x_train, y_train), (x_test, y_test) = mnist.load_data() | |
x_train, x_test = x_train / 255.0, x_test / 255.0 | |
model = tf.keras.models.Sequential([ |
This file contains 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
# resize | |
from skimage.io import imread, imsave | |
from skimage.transform import resize | |
x = imread("X.png") | |
x2 = resize(x, (128, 128)) | |
imsave("resize.png", x2) | |
# overlay | |
from skimage.io import imread, imsave | |
from skimage.transform import resize |
This file contains 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
docker run --rm hello-world |
This file contains 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 nvidia/cuda:9.0-cudnn7-runtime-ubuntu16.04 | |
# Set anaconda(miniconda) path | |
ENV MINICONDA /opt/miniconda | |
ENV PATH $MINICONDA/bin:$PATH | |
# Download anaconda and install it | |
RUN apt-get update && apt-get install -y wget build-essential | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
build-essential \ |
This file contains 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 tqdm import tqdm | |
import numpy as np | |
from skimage.io import imread, imsave | |
win_h = win_w = 640 | |
orig = imread(fname="image_A.png") | |
ours = imread(fname="image_B.png") | |
def main(): | |
for i in tqdm(range(1)): | |
h_bias, w_bias = np.random.randint(0, orig.shape[0]-win_h), np.random.randint(0, orig.shape[1]-win_w) | |
crop_orig = orig[h_bias:h_bias+win_h, w_bias:w_bias+win_w] |