gcloud compute instances create test-k8s \
--boot-disk-size 30G \
--machine-type n1-standard-4 \
--image-project ubuntu-os-cloud \
--image-family ubuntu-1804-lts \
--zone us-central1-a
$ sudo kubeadm init --pod-network-cidr=10.128.0.0/20
# disable swap https://github.com/kubernetes/kubernetes/issues/53533
$ sudo swapoff -a
$ sudo kubeadm init --pod-network-cidr=10.128.0.0/20
$ mkdir -p $HOME/.kube
$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
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
``` | |
019-06-23 12:49:43 ERROR SparkContext:91 - Error initializing SparkContext. | |
org.apache.spark.SparkException: External scheduler cannot be instantiated | |
at org.apache.spark.SparkContext$.org$apache$spark$SparkContext$$createTaskScheduler(SparkContext.scala:2754) | |
at org.apache.spark.SparkContext.<init>(SparkContext.scala:492) | |
at org.apache.spark.SparkContext$.getOrCreate(SparkContext.scala:2493) | |
at org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:934) | |
at org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:925) | |
at scala.Option.getOrElse(Option.scala:121) | |
at org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:925) |
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 scala.language.postfixOps | |
class BankAccount { | |
private var bal: Int = 0 | |
def balance: Int = bal | |
def deposit(amount: Int) = { | |
require(amount > 0) | |
bal += amount | |
} | |
def withdraw(amount: Int): Boolean = { | |
if (amount > bal) false |
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
export type Callback = () => void; |
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
% tree | |
. | |
├── README.md | |
├── index.html | |
├── package.json | |
├── src | |
│ ├── helloModule.ts | |
│ ├── index.ts | |
│ └── wordModule.ts | |
└── tsconfig.json |
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
// 文字列型 にマッピングするEnum | |
object Color extends Enumeration { | |
type Color = Value | |
val Blue = Value("Blue") | |
val Red = Value("Red") | |
val Green = Value("Green") | |
} | |
// 整数型にマッピングするEnum | |
object Bar extends Enumeration { |
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
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.0") |
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
Executor executor = Executors.newFixedThreadPool(2); | |
WebSocketClient client = new WebSocketClient(executor); |
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
//URL to call REST API | |
final HttpPost httpPostRequest = new HttpPost("https://api.parse.com/1/functions/availableCars"); | |
//Application ID | |
httpPostRequest.setHeader("X-Parse-Application-Id", "App-key"); | |
//REST API Key | |
httpPostRequest.setHeader("X-Parse-REST-API-Key", "REST-API-key"); | |
// Content type must be application/json | |
httpPostRequest.setHeader("Content-Type", "application/json"); | |
try { | |
// You have to set valid JSON data as a form data |
NewerOlder