Glide Note

glidenote's blog

XcodeからCommand Line Tools for Xcodeに切り替えたらHDD使用容量が7GB減った

homebrewしか使わないのに、Xcodeに8GBくらいHDDの容量を消費されてて MacBook AirとかにはXcodeを入れていなかったんですが、 先日SDKなどを抜いたCommand Line Tools for Xcodeという200MB程度の 軽量版Xcode(?)がリリースされていたので早速導入。

Command Line Tools for Xcodeが利用出来るのはLionだけです。

どれだけ容量削減になるのか知りたかったので、既にXcode導入済みの Mac miniで作業を行いました。

既存のXcodeを削除

下記コマンドでXcodeを削除

1
sudo /Developer/Library/uninstall-devtools --mode=all /thx

Command Line Tools for Xcodeの導入

Apple Developerのページから Command Line Tools for Xcodeをダウンロードしてきてインストール。

ダウンロードしてきたcommand_line_tools_for_xcode_.dmgをマウントして、 インストーラーを起動させて下記のような感じでインストール。

ちなみにCommand Line Tools for Xcodeに含まれるソフトは下記コマンドで確認できます。 Git関連のツールもちらほら入ってます。

1
2
cd /Volumes/Command\ Line\ Tools/Packages/
pkgutil --payload-files DeveloperToolsCLI.pkg

HDDの使用量の変化

SDK込みのXcode利用時のHDD容量

1
2
3
[akira@macmini] $ df -ah /
Filesystem      Size   Used  Avail Capacity  Mounted on
/dev/disk0s2   148Gi  122Gi   26Gi    83%    /

Command Line Tools for Xcode導入後のHDD容量

1
2
3
[akira@macmini] $ df -ah /
Filesystem      Size   Used  Avail Capacity  Mounted on
/dev/disk0s2   148Gi  115Gi   33Gi    78%    /

なんと7GBも容量減!!素晴らしい。

homebrewも普通に使えているので、しばらくこれで使ってみて 問題が無ければMacBook Airにも入れてみたいと思います。

参考

多段SSHで4段先のサーバに一発ログイン

先日にルータの不具合で、東京本社から福岡支社内の一部開発サーバに直接ssh出来なくなったので、 ProxyCommandを利用して、3個のサーバを経由して目的のサーバにsshしたので、設定のメモ。

やりたいこと

ProxyCommandを利用してcolinuxから複数のサーバを経由して、支社内のサーバに入りたい。 経由するサーバは下記のような感じで中継サーバ3個。

1
2
3
+---------+     +------------+     +--------------+     +----------------+     +---------------+
| colinux | ==> | dev server | ==> | tokyo server | ==> | fukuoka server | ==> | backup server |
+---------+     +------------+     +--------------+     +----------------+     +---------------+

~/.ssh/configの設定確認

自PC内colinuxの~/.ssh/config に下記のように記載。各サーバはssh鍵は通してあります。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Host *
   User maeda

Host dev000
   Hostname 192.168.45.17

Host tokyo
   Hostname manage001.tokyo.pb
   ProxyCommand ssh dev000 nc %h %p

Host fukuoka
   Hostname manage001.fukuoka.pb
   ProxyCommand ssh tokyo nc %h %p

Host backup
   Hostname 192.168.72.51
   ProxyCommand ssh fukuoka nc %h %p

実際にssh接続してみる

~/.ssh/config に設定がしてあるので、下記コマンドだけで3個の中継サーバを経由して、目的のサーバにsshしてくれます。

1
ssh backup

うまく該当サーバに接続出来ました。

ProxyCommandを利用して2段先くらいは日常的にやってますが、 設定さえすれば今回のように何段先でも一発でsshログイン出来ることを理解。 便利すね。

参考

Private RepositoryをBitbucketで管理し始めた

公開しても良いdotfilesは以前からGithub上でglidenote/dotfilesとして 管理していたんですが、パスワードとかを含むアプリの設定ファイルの管理を 自前サーバからBitbucketのprivate repositoryに移行して管理し始めたので作業メモ。

ちなみにBitbucketだと無料でprivate repositoryが作成できます。

Bitbucketのアカウント登録と鍵登録とかの説明は省略。

repositoryの作成

Dashboardの右上にある「Repositories」から「create repository」を選択

repository名などを入力して「Create repository」を選択

clone用のURLが表示されるので、それを元にgit clone

たとえばhogemogeというrepositoryを作成した場合は下記のような感じ

1
2
3
4
5
6
cd
git clone [email protected]:glidenote/hogemoge.git
echo "# This is my README" >> README.md
git add README.md
git commit -m "First Commit. Adding a README."
git push -u origin master

あとは作成したprivate repositoryに管理したいファイルを入れていくだけ。
私はprivate repositoryにファイルを移し、そこからリンクを貼って管理してます。
weechatの設定ファイルは下記のような感じで管理。

1
2
mv ~/.weechat ~/hogemoge
ls -s ~/hogemoge/.weechat ~/.weechat

昨年10月にBitbucketがGitをサポートしたので private repositoryなら自前サーバよりBitBucketが無料だし良いかなと思ってます。

参考サイト

Weegetを利用して、WeeChatのPlugin管理を楽にする

最近IRCクライアントでLimeChatを捨てて、WeeChatを使い始めた人が 周りに増えてきたので、Pluginの導入方法を共有。 私の環境はScientific Linux 6.1ですが、他のOSでもそのまま使えると思います。

weegetを利用してPluginを管理

WeeChatにはWeegetという「Pluginを管理するためのPlugin」があるので一番最初に導入しましょう。

1
2
cd ~/.weechat/python/autoload/
wget http://www.weechat.org/files/scripts/weeget.py

ファイルの配置が終わったらWeeChatから

1
/python autoload

をして、利用出来るようにします。

weegetのコマンド

1
2
3
4
5
6
7
8
9
10
/help weeget

weechat     |          list: list scripts (search text if given)
weechat     | listinstalled: list installed scripts (search text if given)   
weechat     |          show: show detailed information about a script (in repository)
weechat     |       install: install/upgrade script(s)
weechat     |         check: check if local scripts needs upgrade
weechat     |        update: update local scripts cache
weechat     |       upgrade: upgrade all local scripts if they are obsolete
weechat     |        remove: remove script(s)

たとえばめちゃくちゃ便利なbuffers.plを導入する場合は下記のような感じ

1
/weeget install buffers

私の使っているPlugin

  • buffers Sidebar with list of buffers.
  • go Quick jump to buffers.
  • grep Search regular expression in buffers or log files.
  • growl Send Growl notifications upon events.
  • highmon Adds a highlight monitor buffer.
  • im_kayac_com_notify Push notification to im.kayac.com.
  • weeget Scripts manager.

WeeChatを使いこなして、CUI生活を快適にしていきましょう

Fedora16 systemctlコマンドのメモ

自宅サーバはFedora 16で構築してるんですが、systemctlコマンドが全く頭に入ってこないので自分用にメモ。 2回ググったらブログに書く。

たとえばsquidを管理する場合

起動

1
sudo systemctl start squid.service

停止

1
sudo systemctl stop squid.service

再起動

1
sudo systemctl restart squid.service

自動起動設定

1
sudo systemctl enable squid.service

自動起動の解除

1
sudo systemctl disable squid.service

statusを確認

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[akira@mini9] $ sudo systemctl status squid.service
squid.service - Sqid caching proxy
      Loaded: loaded (/lib/systemd/system/squid.service; enabled)
          Active: active (running) since Mon, 06 Feb 2012 00:41:33 +0900; 3min 53s ago
             Process: 3410 ExecStop=/usr/sbin/squid -k shutdown -f $SQUID_CONF (code=exited, status=0/SUCCESS)
                 Process: 3400 ExecReload=/usr/sbin/squid $SQUID_OPTS -k reconfigure -f $SQUID_CONF (code=exited, status=0/SUCCESS)
                     Process: 3418 ExecStart=/usr/sbin/squid $SQUID_OPTS -f $SQUID_CONF (code=exited, status=0/SUCCESS)
                         Process: 3412 ExecStartPre=/usr/libexec/squid/cache_swap.sh (code=exited, status=0/SUCCESS)
                            Main PID: 3419 (squid)
                                  CGroup: name=systemd:/system/squid.service
                                          ├ 3419 /usr/sbin/squid -f /etc/squid/squid.conf
                                                  ├ 3421 (squid-1) -f /etc/squid/squid.conf
                                                          ├ 3426 (logfile-daemon) /var/log/squid/access.log
                                                                  └ 3427 (unlinkd)

その他のコマンド

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[akira@mimi9] $ systemctl
systemctl command
cancel                               -- Cancel all, one, or more jobs
daemon-reexec                        -- Reexecute systemd manager
daemon-reload                        -- Reload systemd manager configuration
default                              -- Enter system default mode
delete                               -- Remove one or more snapshots
disable                              -- Disable one or more unit files
dot                                  -- Dump dependency graph for dot(1)
dump                                 -- Dump server status
emergency                            -- Enter system emergency mode
enable                               -- Enable one or more unit files
exit                                 -- Ask for user instance termination
halt                                 -- Shut down and halt the system
is-active                            -- Check whether units are active
is-enabled                           -- Check whether unit files are enabled
isolate                              -- Start one unit and stop all others
kexec                                -- Shut down and reboot the system with kexec
kill                                 -- Send signal to processes of a unit
list-jobs                            -- List jobs
list-units                           -- List units
load                                 -- Load one or more units
monitor                              -- Monitor unit/job changes
poweroff                             -- Shut down and power-off the system
reboot                               -- Shut down and reboot the system
reload                               -- Reload one or more units
reload-or-restart                    -- Reload one or more units is possible, otherwise start or restart
reload-or-try-restart  force-reload  -- Reload one or more units is possible, otherwise restart if active
rescue                               -- Enter system rescue mode
reset-failed                         -- Reset failed state for all, one, or more units
restart                              -- Start or restart one or more units
set-environment                      -- Set one or more environment variables
show                                 -- Show properties of one or more units/jobs or the manager
show-environment                     -- Dump environment
snapshot                             -- Create a snapshot
start                                -- Start (activate) one or more units
status                               -- Show runtime status of one or more units
stop                                 -- Stop (deactivate) one or more units
try-restart            condrestart   -- Restart one or more units if active
unset-environment                    -- Unset one or more environment variables

systemdでは/lib/systemd/systemに設定ファイルを用意して、 /etc/systemd/system配下のxxxx.wantsへリンクを貼ると自動起動設定となる。

ちなみにzshのバージョンを4.3.15にあげたらsytemctlの補完が効いてくれるようになった