Install rbenv and ruby-build to Amazon Linux (cloud-init).
- Copy & paste content of
user-data.sh
to EC2 RunInstances user-data - Then, logging in to EC2 instance as ec2-user and run
install-ruby.sh
.
user web; | |
# One worker process per CPU core. | |
worker_processes 8; | |
# Also set | |
# /etc/security/limits.conf | |
# web soft nofile 65535 | |
# web hard nofile 65535 | |
# /etc/default/nginx |
Schemaの紹介 | |
Schemaとは | |
・Prismatic社製の型チェックライブラリ | |
・最新版は “0.2.1” | |
https://github.com/prismatic/schema |
(require 'clojure.core.async :refer :all) | |
(def MOVES [:rock :paper :scissors]) | |
(def BEATS {:rock :scissors, :paper :rock, :scissors :paper}) | |
(defn rand-player | |
"Create a named player and return a channel to report moves." | |
[name] | |
(let [out (chan)] | |
(go (while true (>! out [name (rand-nth MOVES)]))) |
Check out README.md to get started editing Clojure with Emacs. |
$ jruby -v | |
jruby 1.6.8 (ruby-1.8.7-p357) (2012-09-18 1772b40) (Java HotSpot(TM) 64-Bit Server VM 1.7.0_02) [linux-amd64-java] | |
$ jruby -S gem --version | |
2.0.0 | |
$ jruby -S gem install jruby-openssl | |
JRuby limited openssl loaded. http://jruby.org/openssl | |
gem install jruby-openssl for full support. | |
ERROR: Loading command: install (LoadError) |
package com.awilmore.ioutils; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.nio.ByteBuffer; | |
import java.nio.channels.Channels; | |
import java.nio.channels.ReadableByteChannel; | |
import java.nio.channels.WritableByteChannel; |
(defn scaffold | |
"Print the ancestor method signatures of a given interface." | |
[iface] | |
(doseq [[iface methods] (->> iface | |
.getMethods | |
(map #(vector (.getName (.getDeclaringClass %)) | |
(symbol (.getName %)) | |
(count (.getParameterTypes %)))) | |
(group-by first))] | |
(println (str " " iface)) |
Install rbenv and ruby-build to Amazon Linux (cloud-init).
user-data.sh
to EC2 RunInstances user-datainstall-ruby.sh
.