Skip to content

Instantly share code, notes, and snippets.

View goddoe's full-sized avatar

Sungju Kim goddoe

View GitHub Profile
@goddoe
goddoe / ubuntu_mount_unmount_disk.sh
Last active January 19, 2018 17:37
How to mount or unmount disk at ubuntu
# 1. find disks
sudo fdisk -l
# Sample of fdisk result
# Disk /dev/sda: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
# Units: sectors of 1 * 512 = 512 bytes
# Sector size (logical/physical): 512 bytes / 512 bytes
# I/O size (minimum/optimal): 512 bytes / 512 bytes
@goddoe
goddoe / make_python3_as_default.sh
Created January 19, 2018 17:11
make python3 as default python in linux
ln `which python3` $(dirname `which python3`)/python
ln `which pip3` $(dirname `which pip3`)/pip
@goddoe
goddoe / check_firewall.sh
Last active January 19, 2018 17:25
check open ports, firewall, port-forwardings
sudo ufw status
@goddoe
goddoe / install_docker.sh
Last active January 21, 2018 05:56
How to install docker
# reference : https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/
# Remove old Docker
sudo apt-get remove docker docker-engine docker.io
# Add repository
sudo apt-get update
sudo apt-get install \
apt-transport-https \
@goddoe
goddoe / update_packages.R
Created January 22, 2018 02:19
R, update packages fast using cranlike
library("cranlike")
update_PACKAGES(dir="path/to/repos", type="source")
from multiprocessing.dummy import Pool
from sklearn.cluster import KMeans
import functools
...
pool = Pool()
results = pool.map(functools.partial(find_cluster, kmeans=kmeans, X=X), clusters)
@goddoe
goddoe / git_diff_exclude_specific_files.sh
Created April 19, 2018 03:00
exclude specific files from git diff
git diff -- . ':(exclude)*.ipynb'
@goddoe
goddoe / simple_http_server_for_python3.sh
Created May 8, 2018 05:42
simple http server for python3
python3 -m http.server
@goddoe
goddoe / export_port_at_docker.txt
Created May 8, 2018 07:18
Export port at docker
Method 1: Using Docker file
EXPOSE 5000-9999
Method 2: Using Run commands
docker run –expose=5000-9999
or
docker run -p 5000-9999:5000-9999
@goddoe
goddoe / generative_vs_discriminative.txt
Last active May 9, 2018 06:21
(Snippet) Intuitive explanation of difference between generative model and discriminative model
reference: https://stackoverflow.com/questions/879432/what-is-the-difference-between-a-generative-and-discriminative-algorithm (by benhamner)
Let's say you have input data x and you want to classify the data into labels y. A generative model learns the joint probability distribution p(x,y) and a discriminative model learns the conditional probability distribution p(y|x) - which you should read as "the probability of y given x".
Here's a really simple example. Suppose you have the following data in the form (x,y):
(1,0), (1,0), (2,0), (2, 1)
p(x,y) is