てしりこじり

しりがちいさいエンジニアがいるという

macOSX に homebrew で perl 環境構築

構築メモ
基本的に rbenv と似たような感じ

plenv 導入!
brew install plenv perl-build
bash_profile に初期化設定を追記する
eval "$(plenv init -)"
インストールできるバージョンを確認
plenv install -l
現状確認
$ perl -v
This is perl 5, version 18, subversion 0 (v5.18.0) built for darwin-2level
インストール
$ plenv install 5.20.0
設定と反映
$ plenv global 5.20.0
$ plenv rehash
バージョン確認
$ perl -v
This is perl 5, version 20, subversion 0 (v5.20.0) built for darwin-2level
モジュール管理の cpanm をインストール
$ plenv install-cpanm
モジュールインストール
$ cpanm JSON
$ cpanm LWP::Simple
等々



Perlについて語ろう

Perlについて語ろう

tar コマンドで絶対パスのアーカイブはダメ絶対

絶対パスでアーカイブすると、展開した時に絶対パスで展開される。
ダメ絶対。

と言われて育ってきました。

しかし最近だと第2引数に絶対パスを指定すると警告してくれるので、
世の中に産み出される悲劇の3%くらいは減っています。

$ tar cvzf /home/hoge/nyamu.tar.gz /home/hoge/nyamu

tar: メンバ名から先頭の `/' を取り除きます

ただ、ふっかいふっかいディレクトリが産み出される悲劇は避けられません。
なのでディレクトリ移動して、相対パスでアーカイブするか、-C オプションを使いましょう。

  • 移動案

いわずもがな。

$ cd /home/hoge
$ tar cvzf /home/hoge/nyamu.tar.gz nyamu
  • -C 案

パスの先の nyamu をアーカイブしてくれます。

$ tar cvzf /home/hoge/nyamu.tar.gz -C /home/hoge nyamu




尻つながり紹介キャンペーン。いい尻。

CentOS (Linux上)で tomcat のバージョンを確認する

以下を実行すると良いらしい。

# ${CATALINA_HOME}/bin/version.sh

やってみた。ちなみに CATARINA_HOME/usr/local/tomcat

$ /usr/local/tomcat/bin/version.sh
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/java/jdk1.7.0_55
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.53
Server built:   Jan 1 2015 01:01:01
Server number:  7.0.53.0
OS Name:        Linux
OS Version:     2.6.32-431.el6.x86_64
Architecture:   amd64
JVM Version:    1.7.0_55-b13
JVM Vendor:     Oracle Corporation

7.0.53 !

詳解 Tomcat

詳解 Tomcat

vagrant-share can't be installed without vagrant login (RuntimeError) に対処

vagrantvagrant−share が RuntimeError

久しぶりに休みなので macvagrant いじろうとしたらエラーナタヨ。

$ vagrant
/Users/hoge/.vagrant.d/gems/gems/vagrant-share-1.1.4/lib/vagrant-share/activate.rb:8:in `rescue in <encoded>': vagrant-share can't be installed without vagrant login (RuntimeError)
  from /Users/hoge/.vagrant.d/gems/gems/vagrant-share-1.1.4/lib/vagrant-share/activate.rb:5:in `<encoded>'
  from /Users/hoge/.vagrant.d/gems/gems/vagrant-share-1.1.4/lib/vagrant-share/activate.rb:16:in `RGLoader_load'
    from /Users/hoge/.vagrant.d/gems/gems/vagrant-share-1.1.4/lib/vagrant-share/activate.rb:16:in `<top (required)>'
  from /Users/hoge/.vagrant.d/gems/gems/vagrant-share-1.1.4/lib/vagrant-share.rb:23:in `require'
  from /Users/hoge/.vagrant.d/gems/gems/vagrant-share-1.1.4/lib/vagrant-share.rb:23:in `block in <class:Plugin>'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/cli.rb:75:in `call'
  from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/cli.rb:75:in `block (2 levels) in help'
  from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/registry.rb:48:in `block in each'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/registry.rb:47:in `each'
  from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/registry.rb:47:in `each'
  from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/cli.rb:69:in `block in help'
    from /Applications/Vagrant/embedded/lib/ruby/2.0.0/optparse.rb:885:in `initialize'
  from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/cli.rb:57:in `new'
  from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/cli.rb:57:in `help'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/cli.rb:32:in `execute'
  from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:292:in `cli'
  from /Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.5/bin/vagrant:174:in `<main>'

$
$
$ vagrant -v
Vagrant 1.6.5
$
$

原因

ruby 2.2.0 にあげたのでその原因かと思いましたが、
調べたら普通にエラーで普通に解決されてました。おうふ。

Running vagrant 1.7.0 without arguments generates "vagrant-share can't be installed without vagrant-login" error · Issue #4923 · mitchellh/vagrant · GitHub

対処

vagrant のアップデートですね。
Vagrant から新しいバージョンをダウンロードしてインストールします。
で。再度実行。

$ vagrant
Usage: vagrant [options] <command> [<args>]

    -v, --version                    Print the version and exit.
    -h, --help                       Print this help.

Common commands:
     box             manages boxes: installation, removal, etc.
     connect         connect to a remotely shared Vagrant environment
     destroy         stops and deletes all traces of the vagrant machine
     global-status   outputs status Vagrant environments for this user
     halt            stops the vagrant machine
     help            shows the help for a subcommand
     init            initializes a new Vagrant environment by creating a Vagrantfile
     login           log in to HashiCorp's Atlas
     package         packages a running vagrant environment into a box
     plugin          manages plugins: install, uninstall, update, etc.
     provision       provisions the vagrant machine
     push            deploys code in this environment to a configured destination
     rdp             connects to machine via RDP
     reload          restarts vagrant machine, loads new Vagrantfile configuration
     resume          resume a suspended vagrant machine
     sandbox
     share           share your Vagrant environment with anyone in the world
     ssh             connects to machine via SSH
     ssh-config      outputs OpenSSH valid configuration to connect to the machine
     status          outputs status of the vagrant machine
     suspend         suspends the machine
     up              starts and provisions the vagrant environment
     version         prints current and latest Vagrant version

For help on any individual command run `vagrant COMMAND -h`

Additional subcommands are available, but are either more advanced
or not commonly used. To see all subcommands, run the command
`vagrant list-commands`.

$
$
$ vagrant -v
Vagrant 1.7.2

動いたよッヽ(゚∀゚)ノ☆

ざっと読みましたが初メテ触るのにはよいのでは。

Vagrant入門ガイド

Vagrant入門ガイド

samba で構築した共有フォルダ上で セキュリティタブを表示させない

samba 案件にて対応したのでメモ。

smb.conf の 対象とする共有フォルダのセクションに以下を追記。
hoge さんの home ディレクトリに 構築した share という共有フォルダに対して実施する。

[share]
  path           = /home/hoge/share
  nt acl support = no 

# 以下、略

これで共有フォルダ内で権限やユーザをいじられなくなる。

参考にさせていただきました。少し古いですが勉強になります。JustSamba

history コマンド で表示させた履歴を実行する

履歴を表示させる history コマンドの使い方。

履歴を表示

$ history

直近10件の履歴を表示

$ history 10
  991  ls -l
  992  ls -l
  993  top
  994  ls -lh
  995  history
  996  cd ~/
  997  vim
  998  ls -l
  999  top
 1000  history 10

history コマンドで表示させた履歴のコマンドを実行する。
997 を実行したい場合。

$ !997

直近のコマンドを実行する。

$ !!

zsh の履歴利用になれてサーバ上で戸惑ったのでメモ。