##To write/save
%%writefile myfile.py
write/save cell contents into myfile.py (use -a to append). Another alias: %%file myfile.py
##To run
%run myfile.py
# References | |
# - https://www.tensorflow.org/versions/r0.10/tutorials/word2vec/index.html | |
# - https://github.com/tensorflow/tensorflow/blob/r0.10/tensorflow/examples/tutorials/word2vec/word2vec_basic.py | |
from __future__ import absolute_import | |
from __future__ import division | |
from __future__ import print_function | |
import collections | |
import math |
val f = sc.textFile("file:///root/pg100.txt") | |
# add line number | |
val f2 = f.zipWithIndex().map { case (line, i) => i.toString + ", " + line } | |
var one_line = "The Project Gutenberg EBook of The Complete Works of William Shakespeare, by" | |
var words = one_line.split(" ") | |
var line_no = 1 | |
val pairs = words.map(word => (word, line_no)) | |
def line_func(line: String, line_no: Long): String = { |
# https://hub.docker.com/r/p7hb/docker-spark/ | |
docker pull p7hb/docker-spark:2.2.0 | |
# run spark | |
docker run -it -p 4040:4040 -p 8080:8080 -p 8081:8081 -h spark --name=spark p7hb/docker-spark:2.2.0 | |
docker start -ai spark | |
# Spark commands |
##To write/save
%%writefile myfile.py
write/save cell contents into myfile.py (use -a to append). Another alias: %%file myfile.py
##To run
%run myfile.py
# download tensorflow python3 version from dockerhub | |
docker pull tensorflow/tensorflow:latest-py3 | |
# add tag to your own repo | |
docker tag tensorflow/tensorflow:latest-py3 yingchendocker/tensorflow:latest-py3 | |
#push image to your docker repo | |
docker push yingchendocker/tensorflow:latest-py3 | |
#For persistent storage: |
PHP handling on apache is done via modules of one sort or another, and running multiple version is problematic on a single instance. The solution is to run two instances of apache on the same machine. This allows one instance to run PHP 7 (the default on 16.04), and another can run PHP 5. Since normal http/https is on ports 80 and 443, the second instance will run on ports 81 and 444. Since it is running on the same machine, all file system and database access is the exact same.
All the commands herein have to be run as root, or with sudo
prefixed to the command.
Read /usr/share/doc/apache2/README.multiple-instances
Run sh ./setup-instance php5
from /usr/share/doc/apache2/examples
, where php5
is the suffix for the second site; all commands for the second site will have that suffix. This will keep all of the same configuration for all sites on the new instance, including SSL certif
#Error 404
$ chmod -R 777 storage/
$ chmod -R 777 vendor/
$ chmod -R 777 bootstrap/