投稿

5月, 2018の投稿を表示しています

Rails 5.2 Active Storageを試してみた

Rails 5.2 Active Storage を試してみた 職場の発表向けに資料を作ったので、一部変更し公開します。 目次 概要 サンプルプログラム CarrierWave との差異 まとめ 概要 Rails 5.2 の新機能 https://railsguides.jp/active_storage_overview.html サンプルプログラム Ruby 2.5.0 Rails 2.5.0.rc1 簡易ブログ 画像のアップロード・表示 (minio(s3)) rails new, scaffold $ rails _5.2.0.rc1_ new active_storage_sample -d mysql -B $ rails generate scaffold Article title:string content:text Active Storage の設定 $ rails active_storage:install マイグレーションファイルが作成される class CreateActiveStorageTables < ActiveRecord : :Migration [ 5.2 ] def change create_table :active_storage_blobs do | t | t . string :key , null : false t . string :filename , null : false t . string :content_type t . text :metadata t . bigint :byte_size , null : false t . string :checksum , null : false t . datetime :created_at , null : false t . index [ :key ] , unique : true end create_table :active_storage_attachments

ASUS TransBook T304UA-7200 でトリプルディスプレイ

イメージ
ASUS TransBook T304UA-7200 でトリプルディスプレイ ASUS TransBook T304UA-7200 でトリプルディスプレイができました。 本体 HDMI USB Type-C to HDMI

NagiosとSlackの連携時、Channelを指定する

NagiosとSlackの連携時、Channelを指定する NagiosとSlackの連携は検索すれば出てくるものの、Channelが固定だったので、Nagiosのcontact毎に指定する方法を記載します。 環境 Slack Ubuntu 16.04 Nagios 3.5.1.dfsg-2.1ubuntu1.3 Slack設定 Slackのアプリを追加で、Nagiosを設定。 手順は、アプリ追加時のセットアップ手順を参照。 Nagios設定 セットアップ手順にて、以下の部分を個別に指定。 command slack_channel に`"#$CONTACTEMAIL$"のマクロを指定 contact email に通知するチャンネルを指定 これで contact ごとに email でチャンネルを指定できる define command { command_name notify-service-by-slack command_line /usr/local/bin/slack_nagios.pl -field slack_channel="#$CONTACTEMAIL$" -field HOSTALIAS="$HOSTNAME$" -field SERVICEDESC="$SERVICEDESC$" -field SERVICESTATE="$SERVICESTATE$" -field SERVICEOUTPUT="$SERVICEOUTPUT$" -field NOTIFICATIONTYPE="$NOTIFICATIONTYPE$" } define command { command_name notify-host-by-slack command_line /usr/local/bin/slack_nagios.pl -field slack_channel="#$CONTACTEMAIL$" -field HOSTALIAS="$HOSTNAME$" -field HOSTSTATE="$HOST