tkuchikiの日記

新ブログ https://blog.tkuchiki.net

2013-02-01から1ヶ月間の記事一覧

BSD(Mac) で find xargs sed を使う際の注意点

ファイルを一括置換するときに、 find /path/to/dir -type f | xargs sed -i "s/hoge/foobar/g" みたいにコマンドを打つことがあると思いますが、 Macでは、 sed: 1: "/path/to/dir": invalid command code . や、 sed: 1: "path/to/dir/file": extra charac…

curl でファイルをPOST送信する方法とエラーの対処法

curlでファイルを送ろうとしたら少しハマったので、メモ。curl コマンドでファイルを送る方法は、manを見ると以下のようになっている。 -F/--form <name=content> (HTTP) This lets curl emulate a filled-in form in which a user has pressed the sub- mit button. This </name=content>…

Apache と Nginx でBasic認証をかける&特定IPのみ許可の設定

設定する度にググっているのでメモ。 Apache # Basic auth AuthUserFile /var/www/html/example.com/.htpasswd AuthGroupFile /dev/null AuthName "basic authentication" AuthType Basic require valid-user Satisfy any Order deny,allow Deny from all Al…

sshで「Too many authentication failures for ...」が出た場合の対処法

ssh

sshでID / PW や接続先は間違っていないのに、タイトルのようなエラーが出てアクセス出来ない時がある。 エラーの意味は、設定している最大試行回数を超えたというもの。 接続情報が間違っていないのに試行回数を超えてしまうかというと、登録している鍵が多…

ApacheとNginxでバージョン情報を非表示にする方法

バージョン情報を表示するのはセキュリティ上あまり良くないので、非表示にしたい。 という時の設定。 Apache 以下をhttpd.conf に書けば全体に反映される。 ServerTokens Prod 以下を設定すると、Apache Server ... も消すことができる。 ServerSignature O…

Nginx で主要な static file を返す設定

拡張子で判断。 大抵の場合はこれでいいはず。 location ~ \.(js|css|png|jpe?g|gif|swf|txt|ico) { root /path/to/dir; }

Mac OS X Lion ? で VPN接続中に /etc/hosts を変更する際の注意点

Mac OS X Lion だけで発生する現象かはわからないが、 VPN接続中に /etc/hosts を編集しても、 VPNの接続を切ると変更した内容が元に戻ってしまうという現象が起きた。 というメモ。

Excel の 日付データ(数値)をプログラムで取得した際、テキストに変換する方法

PHPExcelで日付データを取得しようとしたときに、 1970/1/1 ではなく、 25569 が取得されてしまった。 調査した結果、Excel では、日付データを 1900/1/1 からの経過日数で保存しているためということがわかった。ExcelではTEXTという関数があって、それを使…

ssh接続を鍵認証で行う際の設定

毎回ググっているので、メモしておく。 鍵作成 ssh-keygen -f ~/.ssh/example.com_rsa -t rsa Generating public/private rsa key pair. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in …

Symfony2 で composer install|update 時に、「Class .... is not autoloadable, can not call post-update-cmd script 」が出た時の対処法

php composer.pher install|update で、 Class .... is not autoloadable, can not call post-update-cmd script が出たら、 vendor を消して入れなおせばいいそうです。 一々消すの面倒ですね。※参考 https://github.com/symfony/symfony-standard/issues/2…