2014年6月4日水曜日

Ruby から Mac OS X の Notification Center に通知を送る

rubyからMac OS XのNotification Centerに通知を送る


gemのインストール
$ gem install terminal-notifier      

サンプルファイル notification.rb
TerminalNotifier.notify('Hello World', :title => 'Terminal', :subtitle => 'Programming Language Ruby', :sound => 'Hero')     

実行
$ ruby notification.rb     

参考

https://github.com/alloy/terminal-notifier/
https://github.com/alloy/terminal-notifier/

コマンドラインで誤って大事なファイルを削除しないために rmtrash を使う


コマンドラインで誤って大事なファイルを削除しないためにrmtrashを使う


前提

Homebrewがインストールされている
Homebrew
http://brew.sh

rmtrashコマンドをインストール
$ brew install rmtrash

~/.bash_profile に 以下追記
alias rm="echo Use del, or full path name for rm"
alias del="rmtrash" #del is shorter as rmtrash, or simply use rmtrash directly

使い方

$ rm foo.txt
Use del, or full path name for rm foo.txt
警告される

$ del foo.txt
としても、
foo.txtは削除されず、~/.Trash/foo.txtに移動されるだけ。

ゴミ箱の中に移動されるだけなので、間違えたら戻すことができる。
ゴミ箱を空にした場合は、戻せない。

参考

http://apple.stackexchange.com/questions/17622/how-can-i-make-rm-move-files-to-the-trash-can
http://apple.stackexchange.com/questions/17622/how-can-i-make-rm-move-files-to-the-trash-can

2014年4月17日木曜日

docker 0.10.0 で ubuntu 14.04 の Custom Base Image を作成する


docker 0.10.0 で ubuntu 14.04 の Custom Base Image を作成する

環境

ubuntu 14.04 beta

debootstra(インストーラ)をインストール。

$ sudo apt-get install debootstra

作業ディレクトリの作成。

$ mkdir ~/dockerImage
$ cd ~/dockerImage

turstyディレクトリを自動作成し、必要なファイルを集める。

$ sudo debootstrap trusty trusty > /dev/null
$ ls

turstyディレクトリをdockerイメージとしてインポートする

$ sudo tar -C trusty -c . | sudo docker import - trusty:14.04
$ sudo docker images

不要なものは消す

$ sudo rm -R ./trusty

参考

Create a Base Image
http://docs.docker.io/en/latest/articles/baseimages/

2014年4月16日水曜日

Fedora19 から Fedora20 へのアップグレード

Fedora19 から Fedora20 へのアップグレードした

環境

Fedora19
VirtualBox 4.3.8

Fedora19 から Fedora20 へのアップグレード


fedupコマンドを使うのでインストール

# yum install fedup

fedora-releaseを更新

# yum update fedora-release

fedupを使ってFedora 20へアップグレード

# fedup --network 20

VBoxGuestAddition の更新


# VBOX_VERSION=$(cat /etc/vagabond_vbox_version)
# wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
# mount -o loop,ro VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
# sudo sh /mnt/VBoxLinuxAdditions.run
# sudo umount /mnt

FreeBSD 10 で デスクトップ環境を構築する

FreeBSD 10 で デスクトップ環境を構築する

pkgの使い方


  • pkg update -f #パッケージのデータベースを最新版にする
  • pkg search curl #curlを探す
  • pkg info curl #curlの情報を見る
  • pkg install curl #curlをインストールする
  • pkg delete curl #インストール済みのcurlを削除する
  • pkg autoremove curl #不要なダウンロード済みパッケージを削除する
  • pkg upgrade #インストール済みのパッケージをすべてアップグレード

参考
freebsd.org/doc/handbook Using pkgng for Binary Package Management