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
$ mirb | |
mirb Embeddable Interactive Ruby Shell | |
> |
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
def fixed_header(params) | |
message_type = params[:message_type] || 1 | |
dup = params[:dup] || 0 | |
qos = params[:qos] || 0 | |
retain = params[:retain] || 0 | |
remaining_size = params[:remaining_size] || 0 | |
data_1 = (message_type << 4) | (dup << 3) | (qos << 1) | retain | |
data_2 = remaining_size | |
data_1.chr + data_2.chr |
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
start_time = Time.now | |
Array.new(1000000, 1).lazy.map{|e| e}.take(3).force | |
end_time = Time.now | |
process_time = end_time - start_time | |
puts "process time: #{process_time}" |
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
MRuby::Build.new do |conf| | |
... | |
conf.gem :github => 'mattn/mruby-uv' #追加 | |
... | |
end |
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
conf.gem '../mruby-mqtt' |
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
FROM ubuntu | |
MAINTAINER Shin Hiroe <[email protected]> | |
RUN echo "upgrade apt sources" | |
RUN apt-get update | |
RUN apt-get upgrade -y | |
EXPOSE 1883 | |
RUN echo "install Mosquitto" | |
RUN apt-get install mosquitto -y |
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
FROM ubuntu | |
MAINTAINER Shin Hiroe <[email protected]> | |
RUN echo "upgrade apt sources" | |
RUN apt-get update | |
RUN apt-get upgrade -y | |
RUN echo "install wget" | |
RUN apt-get install wget -y |
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
$ sudo apt-get install libpam0g-dev | |
$ sudo apt-get install libssl0.9.8 |
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
/buckets/<bucket>/keys/<key> |
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
$ riak-admin bucket-type create maps '{"props":{"datatype":"map"}}' | |
maps created | |
$ riak-admin bucket-type create sets '{"props":{"datatype":"set"}}' | |
sets created | |
$ riak-admin bucket-type create counters '{"props":{"datatype":"counter"}}' | |
counters created |