<mazgi.github.io 移行済>#morisnite 2で生ハム原木担いでラーメンが美味しかった話

移動しました

https://mazgi.github.io/posts/2015.02/morisnite-02-with-whole-prosciutto/


モリスナイト2で無事に生ハムをdeployすることができた。
骨は@mirakuiさんが美味しいラーメンにしてくださった。

morisnite

例の@tagomorisさんと酒を飲む会である。

ノリで生ハム原木をポチったので担ぐことにした。

まずビールの量が恐ろしかった。
フリークアウトさんの広いカウンターが埋まるほどの量だった。
なおすべてなくなったらしい。

生ハム原木も f:id:mazgi:20150206194326j:plain あと栓抜きを持ち帰るのを忘れた
モリスさんや皆さんにカットしていただき(念のためモザイクをかけた) f:id:mazgi:20150206194519j:plain 無事 f:id:mazgi:20150206210628j:plain 完食された f:id:mazgi:20150206225108j:plain なお骨は@sora_hさんが持って帰ってくださった。

爪が飛び出た豚の脚(しかも骨のみ)を運んでいただきありがとうございます。
(生ハム原木ラーメン布石となる)

生ハム原木の持ち込みを黙認(あるいはスルー)していただいた@myfinderさんと会場を貸してくださったフリークアウト様ありがとうございます。

生ハム原木ラーメン

@mirakuiさんが生ハム原木の骨をラーメンにしてくださるとのことでお呼ばれしてきた。 それはもう美味かった。

f:id:mazgi:20150216131950j:plain チャーシューがとても美味かったのだが、チャーシューと別に生ハムの一部も入っておりそれはたしかにチャーシューとは異なる旨さで「ああ、たしかにmorisniteの生ハムだ」と感慨に浸らせられるものだった。

f:id:mazgi:20150216133937j:plain 完食。

f:id:mazgi:20150216130813j:plain 原木はこのように煮込まれていた

f:id:mazgi:20150216135055j:plain あとクックパッドさんのオフィスはとても眺めが良かった

仕込んでくださった@mirakuiさん、原料を運んでくださった@sora_hさん、「昼にエンジニアが集まってラーメンを食う」ただそれだけのためにテーブルを貸してくださったクックパッド様ありがとうございました。

morisnite 準備

ここで書かないと書く機会がなさそうなのでdeployまでの準備などを記録しておく。

生ハム原木が早く着きすぎたので冷却に悩んだ。
しかしコンビニの板氷4枚とエアキャップ少々、そして耐水性の箱(衣装ケースなどを想像していただきたい)で解決した。
(当日運搬中と開封後に触診により温度を確認したが冷えていたので解決したと考えている)

f:id:mazgi:20150202000948j:plain + SUN UP(サンアップ) 包装緩衝材 プチプチ d36 巾600mm×全長10m

運搬には公共交通機関を活用した。

f:id:mazgi:20150206185356j:plain

中央線乗車中の生ハム原木

f:id:mazgi:20150206191046j:plain

六本木駅のホームで佇む生ハム原木

f:id:mazgi:20150206191342j:plain

エスカレーターを昇る生ハム原木

f:id:mazgi:20150206192048j:plain

ヒルズと生ハム原木(重すぎて片手で持ち上げるのはこれが限界だった)

なおせっかくの機会なのでタイトル通り担いだ
(背景のイケてるスペースはフリークアウト様オフィスである) f:id:mazgi:20150206192907j:plain

How to install #innobackupex on #Gentoo Linux

Install xtrabackup-bin

# emerge -pvq xtrabackup-bin
[ebuild   R   ] dev-db/xtrabackup-bin-2.2.5 
# equery f xtrabackup-bin
 * Searching for xtrabackup-bin ...
 * Contents of dev-db/xtrabackup-bin-2.2.5:
/usr
/usr/bin
/usr/bin/innobackupex
/usr/bin/xbcrypt
/usr/bin/xbstream
/usr/bin/xtrabackup

Download and extract qpress

Download qpress-11-linux-x64.tar from this site:

Fast compression library for C, C# and Java

And extract qpress command.

# tar xvf qpress-11-linux-x64.tar -C /usr/local/bin/
qpress

Run innobackupex

  • Backup
# innobackupex --defaults-file=/etc/mysql/my.cnf --user=$USER --password=$PASS --ibbackup=xtrabackup --slave-info --safe-slave-backup --compress $TARGET_DIR
  • Restore
# innobackupex --user=$USER --password=$PASS --decompress $BACKUP_DIR
# innobackupex --user=$USER --password=$PASS --apply-log $BACKUP_DIR
# innobackupex --copy-back $BACKUP_DIR
# chown -R mysql:mysql /var/lib/mysql

How to increase ulimit on #Gentoo ?

追記

Gentoo忘年会ー勉強会 2014-12-20 - connpassGentoo Advent Calendar 2014 - Qiitaの存在を知りましたのでお酒を呑みながら慎重に検討した結果この記事は21日目に再配置されました。 ときにはそういうことも必要だと思います!

20日目は@aliceinwireさんでした。 22日目は@kizononnさんです。

追記ここまで


Linuxサーバーを運用していると"Too many open files"に出くわし"ulimit 反映されない"でググって Linux サーバでの「Too many open files」対策について - akishin999の日記ulimitが効かない不安を無くす設定 | 外道父の匠 のお世話になるのはままある話。

Gentooの場合、起動スクリプトで起動するプロセス(いわゆるdaemon)であれば簡単にulimitを設定できる。


たとえばRedmineをdaemon化するこんな起動スクリプトを書いたとして、

[root@redmine-host] # cat /etc/init.d/redmine
#!/sbin/runscript
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

description="Redmine daemon"

REDMINE_ENVIRONMENT="${REDMINE_ENVIRONMENT:-production}"
REDMINE_USER="${REDMINE_USER:-redmine}"
REDMINE_GROUP="${REDMINE_GROUP:-redmine}"
REDMINE_NAME="${SVCNAME##*.}"
if [ -n "${REDMINE_NAME}" -a "${SVCNAME}" != "redmine" ]; then
  description="${description} for ${REDMINE_NAME}"
  REDMINE_PID_FILE="/var/run/redmine.${REDMINE_NAME}.pid"
  REDMINE_RB_DEFAULT="/etc/redmine/${REDMINE_NAME}.rb"
else
  REDMINE_PID_FILE="/var/run/redmine.pid"
  REDMINE_RB_DEFAULT="/etc/redmine/unicorn.rb"
fi
REDMINE_DIR="${REDMINE_DIR:-/var/lib/redmine}"
REDMINE_RB="${REDMINE_RB:-${REDMINE_RB_DEFAULT}}"
REDMINE_WORKER_PROCESSES="${REDMINE_WORKER_PROCESSES:-4}"
REDMINE_BUNDLE_EXEC="${REDMINE_BUNDLE_EXEC:-/usr/local/bin/bundle}"
LD_PRELOAD_OPTS=""
if [ -f "/usr/lib64/libjemalloc.so" ]; then
  LD_PRELOAD_OPTS="/usr/lib64/libjemalloc.so"
fi

depend() {
  need net
}

start() {
  ebegin "Starting ${SVCNAME}"
  start-stop-daemon \
    --start \
    --chdir "${REDMINE_DIR}" \
    --user "${REDMINE_USER}" \
    --background \
    --make-pidfile --pidfile "${REDMINE_PID_FILE}" \
    --env PATH="${PATH}:$(dirname ${REDMINE_BUNDLE_EXEC})" \
    --env LD_PRELOAD="${LD_PRELOAD_OPTS}" \
    --env REDMINE_PID_FILE="${REDMINE_PID_FILE}" \
    --exec "${REDMINE_BUNDLE_EXEC}" \
    -- exec unicorn_rails -c "${REDMINE_RB}" -E "${REDMINE_ENVIRONMENT}"
  eend $?
}

stop() {
  ebegin "Stopping ${SVCNAME}"
  start-stop-daemon --stop --pidfile "${REDMINE_PID_FILE}"
  eend $?
}

/etc/conf.d/SVCNAMErc_ulimitを書いておくと反映してくれる。

[root@redmine-host] # cat /etc/conf.d/redmine
rc_ulimit="-n 65535"
rc_need="nginx"

REDMINE_DIR="/var/lib/redmine/versions/current"
REDMINE_BUNDLE_EXEC="/usr/local/bin/bundle"
REDMINE_RB="/var/lib/redmine/versions/current/config/unicorn.rb"

便利!

[root@redmine-host] # cat /proc/$(cat /var/run/redmine.pid)/limits
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             3981                 3981                 processes 
Max open files            65535                65535                files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       3981                 3981                 signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us        

ちなみにcomment outすると

[root@redmine-host] # grep rc_ulimit /etc/conf.d/redmine
#rc_ulimit="-n 65535"

こんな感じ。

[root@redmine-host] # cat /proc/$(cat /var/run/redmine.pid)/limits
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             3981                 3981                 processes 
Max open files            1024                 4096                 files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       3981                 3981                 signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us        

Tried the Mount Engine

id:onk さんのMount Engineの記事読んだら便利そうだったのでやってみた。

Railsプロジェクトの作成

まずおもむろにGitHubリポジトリをつくり

  • rbenv local
  • bundle install --path=vendor/bundle
  • bundle exec rails new .

等の儀式を済ませる。 差分は下記の通り。

[diff]Create a Rails project

welcome controllerというHello World的なControllerとViewを作る

[diff]Create a Rails controller
[diff]Create a Rails view

bundle exec rake routesの結果はこんな感じ

[mazgi@Balmung] $ bundle exec rake routes
Prefix Verb URI Pattern Controller#Action
  root GET  /           welcome#index

Welcome!と表示された。

f:id:mazgi:20141218081321p:plain

Mount Engineを試す

記事を参考にconfig/routes.rb

mount proc {|env| [200, {}, ["Hello from mounted engine!"]] }, at: "hello_mount_engine"

の1行を書き加えてみる。

[diff]Add mount to routes

routeが増えた。

[mazgi@Balmung] $ bundle exec rake routes
Prefix Verb URI Pattern         Controller#Action
  root GET  /                   welcome#index
            /hello_mount_engine #<Proc:0x007f138f7872c0@/home/mazgi/Creations/MountableEngineTestDrive/config/routes.rb:4>

/hello_mount_engineというpathでちゃんと表示された。

f:id:mazgi:20141218082001p:plain

Sinatraアプリをマウントしてみる

まずとても簡単なSinatraアプリを作る。 内容はこれだけ:

[mazgi@Balmung] $ < lib/sinatra_app/app.rb
require 'sinatra/base'

class HelloFromSinatra < Sinatra::Base
  set :bind, '0.0.0.0'

  get "/" do
    "I am Sinatra!"
  end

  get "/hello" do
    "Hello from Sinatra!"
  end

  run! if app_file == $0
end

[diff]Create a Sinatra App

まずは単体でbundle exec ruby lib/sinatra_app/app.rb -e productionする。 '/'と'/hello'はそれぞれ次のように表示される。

f:id:mazgi:20141218082749p:plain

f:id:mazgi:20141218082659p:plain

ではいよいよSinatraアプリをRailsアプリにマウントしてみる。

まずconfig/application.rb

require Rails.root.join("lib/sinatra_app/app")

の1行を追加し、次にconfig/routes.rbにSinatraアプリをmountする。

mount HelloFromSinatra, at: "hello_sinatra"

[diff]Add mount for Sinatra app to routes

bundle exec rake routesの出力が増えている。

[mazgi@Balmung] $ bundle exec rake routes
            Prefix Verb URI Pattern         Controller#Action
              root GET  /                   welcome#index
                        /hello_mount_engine #<Proc:0x007fb0335f85a8@/home/mazgi/Creations/MountableEngineTestDrive/config/routes.rb:4>
hello_from_sinatra      /hello_sinatra      HelloFromSinatra

簡単にRailsアプリからSinatraアプリを呼び出せた。

f:id:mazgi:20141218083748p:plain

f:id:mazgi:20141218083801p:plain

Mount Engine便利っぽいしドリコム Advent Calendar 2014勉強になる。

moved my blog

I moved my blog to blog.mazgi.net from self hosted WordPress site.
WordPress is good product, but I was tired of updating wordpress and plugins.

ブログ移行しました。
WordPressの運用に疲れたので。

旧サイトからは↓みたいにリダイレクトしておいた。

location = / {
  rewrite ^(.*)$ http://blog.mazgi.net$1 permanent;
}
location ~* ^/\d+/\d+/.*/$ {
  rewrite ^/(\d+)/(\d+)/(.*)/$ http://blog.mazgi.net/entry/$3 permanent;
  rewrite_log on;
}

submitted #Keymotion App as a control Keynote by #LeapMotion to #Airspace

Previously, I were introduced to the program that can be control Keynote by LeapMotion(blog in Japanese), but was submitted to the Airspace in the App!

What's App?

By the swipe on the LeapMotion, you can control the Keynote.

#LeapMotion Keynote slideshow using Leap Motion from Hidenori MATSUKI on Vimeo.

Story

Last year, I received a Leap Motion Controller that was pre-order! I had made the program for oneself, but I decided to publish because there was a demand on Twitter.

@vassko Thank you very much for giving me this opportunity!

Usage & System Requirements

System Requirements

It has been confirmed in the following two environments: It doesn't correspond to the PowerPoint and Windows.

  • MacOSX 10.9+Keynote 6.2
  • MacOSX 10.8+Keynote 5.3

Usage

Start & Stop

Please make sure "Allow Background Apps" is On in your "Leap Motion Control Panel".

f:id:mazgi:20141210072955p:plain

Item called "KM" in the menu bar will appear when you start the app.

f:id:mazgi:20141210073018p:plain

f:id:mazgi:20141210073041p:plain

Click the "Quit Keymotion" in the "KM" when you end.

f:id:mazgi:20141210073050p:plain

Control slideshow

You can control the Keynote slideshow.

First, Open a single Keynote slideshow. Next, Operations are as follows:

Swipe Up
Start slideshow
Swipe to the Right
Show next slide
Swipe to the Left
Show previous slide
Swipe Down
Stop slideshow

I want to be able to customise the combination of the operation and thresholds of gesture in the future.

As long as us to cooperate in the beta test, please contact the blog comment or Twitter.