Skip to content

Instantly share code, notes, and snippets.

View goddoe's full-sized avatar

Sungju Kim goddoe

View GitHub Profile
@goddoe
goddoe / mnist_cnn_bn.py
Created September 26, 2017 03:42 — forked from tomokishii/mnist_cnn_bn.py
MNIST using Batch Normalization - TensorFlow tutorial
#
# mnist_cnn_bn.py date. 5/21/2016
# date. 6/2/2017 check TF 1.1 compatibility
#
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
library(miniCRAN)
# Create local cran directory
repo <- 'http://cran.nexr.com'
dir.create(pth <- file.path('local_cran'))
# Sync All Available Repositories
avail_pkgs <- pkgAvail(repos= repo, type='source')[,1]
makeRepo(avail_pkgs, path=pth, repos=repo)
import numpy as np
import rpy2.robjects as robjects
from rpy2.robjects import numpy2ri
from rpy2.robjects.packages import importr
r = robjects.r
numpy2ri.activate()
#!/usr/bin/env bash
# Constants
PORT=5000
# Install start
echo "Install R studio..."
sudo apt-get install r-base
sudo apt-get install gdebi-core
wget https://download2.rstudio.org/rstudio-server-1.1.383-amd64.deb
import argparse
from models.model import model_class, model_type
from libs.utils import run_train
"""
Main
"""
@goddoe
goddoe / simple_web_server_for_r.py
Last active December 27, 2017 02:08
Simple web server for R
#!/usr/bin/env python
import os
import argparse
from http.server import (HTTPServer,
SimpleHTTPRequestHandler)
LOCAL_CRAN_PATH = os.path.join(os.path.dirname(__file__), 'local_cran')
SERVER_ADDRESS = '0.0.0.0'
PORT = 7777
@goddoe
goddoe / Dockerfile
Last active December 27, 2017 07:43
Dockerfile for Korean UTF-8 Support
FROM ubuntu:16.04
RUN apt-get clean && apt-get update && apt-get install -y locales
RUN locale-gen ko_KR.UTF-8
ENV LANG ko_KR.UTF-8
ENV LANGUAGE ko_KR.UTF-8
ENV LC_ALL ko_KR.UTF-8
@goddoe
goddoe / Dockerfile
Last active January 3, 2018 08:08
Simple examples for making Dockerfile, building docker image with dockerfile and running docker container.
FROM ubuntu:16.04
MAINTAINER company_name <user@email.com>
# Variables
ARG working_dir=/app
ENV WORKING_DIR=${working_dir}
# Update ubuntu & Install python3
RUN apt-get clean && apt-get update && apt-get upgrade -y
RUN apt-get install -y python3-dev
@goddoe
goddoe / run_example.sh
Last active January 9, 2018 03:03
Methods to update R repository's PACKAGES file fast
#!/usr/bin/env bash
Rscript update_r_packages.R --dir "local_cran/src/contrib"
@goddoe
goddoe / current_script_abs_path.sh
Created January 19, 2018 06:33
get absolute path of current running shell script
# reference : https://stackoverflow.com/questions/4774054/reliable-way-for-a-bash-script-to-get-the-full-path-to-itself
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
echo $SCRIPTPATH