ASP.NET 用の 認証用の Http Module を作りました。
HttpAuthModule
NuGet Gallery | Http Auth Module 2.2.2
GitHub - nabehiro/HttpAuthModule: Http Basic, Digest Authentication Module with IP Restriction
特徴
- ベーシック認証
- ダイジェスト認証
- クライアント IP のチェック
- URL無視リスト: 認証、IPチェックをスキップするパスの指定
導入方法
Nuget でインストールしたあとに、Web.config を微調整
対象
- .NET Framework v4.5 以上
- ASP.NET (MVC), Sitecore CMS もいけます
- PHP でも使えるみたいです
herokuでデータベースのバックアップ(pgbackups)を自動化する
heroku から「bundlesは、4/4に終わるからpgbackups使えや〜」とメールが来たので、pgbackupsの自動化を調べてみた。
herokuのデータベースのバックアップをcronで自動化するには、下記の gem を使えばOK。
GitHub - ddollar/heroku_backup_task: This project has a new maintainer
pgbackups addon は、無料版だとバックアップを2つ保持できます。
この gem は既に2つのバックアップがある場合は、古いバックアップを破棄して新しいバックアップを作成します。
(heroku pgbackups:capture --expire と同じ動作)
install方法に書いてあるとおり、
Gemfile に追加
gem "heroku_backup_task"
cron.rake
require "heroku_backup_task" desc 'execute hourly task' task :cron do # other code here HerokuBackupTask.execute end
heroku にpush して実行した結果は、下記のような感じ。
$ heroku pgbackups ID | Backup Time | Size | Database -----+---------------------+------------+------------- b004 | 2011/01/26 08:18.53 | 942.0bytes | DATABASE_URL b005 | 2011/01/26 08:37.08 | 942.0bytes | DATABASE_URL $ heroku rake cron (in /disk1/home/slugs/1ba16e10-bb38-41a1-a6e2-7cb3f205636b/mnt) [Wed Jan 26 08:44:51 -0800 2011] starting heroku backup task [Wed Jan 26 08:44:51 -0800 2011] backing up: DATABASE_URL $ heroku pgbackups ID | Backup Time | Size | Database -----+---------------------+------------+------------- b005 | 2011/01/26 08:37.08 | 942.0bytes | DATABASE_URL b006 | 2011/01/26 08:44.51 | 942.0bytes | DATABASE_URL
作者の、 ddollar さんはherokuの便利そうなgem結構つくっているなぁ。
GitでのCRLF
windowsでgitを利用する際に、msysgit を利用していて
あまり改行コードを意識しなかったのですが、
macに行った際ちょっと戸惑ったので。
mysysgitでは、特に何も設定しないでも
CRLFの扱いの設定が、下記のようになっています。
core.autocrlf=true
この設定は、リポジトリからソースを取得する際に、LFをCRLFにしたり、リポジトリに追加する際に
CRLFをLFにしてくれるようです。
Git - リビジョンの選択 のautocrlfを参照。
core.autocrlfには、inputという指定がありこの設定を行うと、リポジトリから取得する際は、
特に何もせず、リポジトリに追加する際にCRLFをLFにしてくれるそうです。
なので、私はmacを使う際、とりあえず余計な改行コードを挿入させたくないので、有効にしています。
core.autocrlf=input
autocrlf=inputを有効にするには下記で。
$ git config --global core.autocrlf input
snow leopard 再インストール + アプリセットアップ 備忘録
mac を使って約2ヶ月がたって、適当にアプリをいれていたので整理して再インストールする。
その際の備忘録を取っておく。
OS 再インストール
セットアップ + アプリインストール
[システム環境変数] -> [アカウント] で鍵マークを外し、自分のアカウントを選択して Ctrl + クリック
-
- TerminalColoreopard
- .bashrc 追加
- .emacs 追加
- .zshrc 追加
基本は、漢のzsh最終回を参考にする。
プロンプトは、漢で紹介されているモノは好きになれなかったのでzshの基本的な使い方 2/3 「bash風プロンプト」編 - ナレッジエースを参考にする。
漢のモノだと無効化されている「predict-on」の機能は有効化する。強力だけど、その強力な機能上に意図しない動きをすることがあるけど、そのうち慣れてくれば使いこなせるはず!
[システム環境変数] -> [Spotlight] から、Ctrl + Space のキーを変更する。
- textmate
- プロジェクトツリーで、ソース管理の状態がわかるように、 ProjectPlus.tmplubin をインストール
- 日本語が扱えるように CJK-Input.tmplugin、小夏フォント(mate用)をインストールんp
- bundle editor で一部ショートカット変更
- textmateをdefaultのテキストエディタにする(Mac OS X デフォルトのアプリケーションを変更する 参考)
- Skype
- KeyRemap4MacBook
- Flip4mac
- realplayer
- mac port
- PostgreSQL 9.0.2
- StartupSound.prefPane
.zshrc
## 1 word alias # alias e='emacs' alias m='mate' ## add env path (mac ports..) # export PATH=/opt/local/bin:/opt/local/sbin/:$PATH export MANPATH=/opt/local/man:$MANPATH ## CLICOLOR export CLICOLOR=1 ## Environment variable configuration # # LANG # export LANG=ja_JP.UTF-8 case ${UID} in 0) LANG=C ;; esac ## Default shell configuration # # set prompt # autoload colors colors PROMPT="%{${fg[blue]}%}[%n@%m:%1~] %(!.#.$) %{${reset_color}%}" PROMPT2="%{${fg[blue]}%}%_> %{${reset_color}%}" SPROMPT="%{${fg[red]}%}correct: %R -> %r [n,y,a,e]? %{${reset_color}%}" RPROMPT="%{${fg[green]}%}[%~]%{${reset_color}%}" # case ${UID} in # 0) # PROMPT="%{${fg[cyan]}%}$(echo ${HOST%%.*} | tr '[a-z]' '[A-Z]') %B%{${fg[red]}%}%/#%{${reset_color}%}%b " # PROMPT2="%B%{${fg[red]}%}%_#%{${reset_color}%}%b " # SPROMPT="%B%{${fg[red]}%}%r is correct? [n,y,a,e]:%{${reset_color}%}%b " # ;; # *) # PROMPT="%{${fg[red]}%}%/%%%{${reset_color}%} " # PROMPT2="%{${fg[red]}%}%_%%%{${reset_color}%} " # SPROMPT="%{${fg[red]}%}%r is correct? [n,y,a,e]:%{${reset_color}%} " # [ -n "${REMOTEHOST}${SSH_CONNECTION}" ] && # PROMPT="%{${fg[cyan]}%}$(echo ${HOST%%.*} | tr '[a-z]' '[A-Z]') ${PROMPT}" # ;; # esac # auto change directory # setopt auto_cd # auto directory pushd that you can get dirs list by cd -[tab] # setopt auto_pushd # command correct edition before each completion attempt # setopt correct # compacked complete list display # setopt list_packed # no remove postfix slash of command line # setopt noautoremoveslash # no beep sound when complete list displayed # setopt nolistbeep ## Keybind configuration # # emacs like keybind (e.x. Ctrl-a goes to head of a line and Ctrl-e goes # to end of it) # bindkey -e # historical backward/forward search with linehead string binded to ^P/^N # autoload history-search-end zle -N history-beginning-search-backward-end history-search-end zle -N history-beginning-search-forward-end history-search-end bindkey "^p" history-beginning-search-backward-end bindkey "^n" history-beginning-search-forward-end bindkey "\\ep" history-beginning-search-backward-end bindkey "\\en" history-beginning-search-forward-end ## Command history configuration # HISTFILE=~/.zsh_history HISTSIZE=50000 SAVEHIST=50000 setopt hist_ignore_dups # ignore duplication command history list setopt share_history # share command history data ## Completion configuration # fpath=(${HOME}/.zsh/functions/Completion ${fpath}) autoload -U compinit compinit ## zsh editor # autoload zed ## Alias configuration # # expand aliases before completing # setopt complete_aliases # aliased ls needs if file/dir completions work alias where="command -v" alias j="jobs -l" case "${OSTYPE}" in freebsd*|darwin*) alias ls="ls -G -w" ;; linux*) alias ls="ls --color" ;; esac alias la="ls -a" alias lf="ls -F" alias ll="ls -l" alias lla="ls -la" alias du="du -h" alias df="df -h" alias su="su -l" ## terminal configuration # case "${TERM}" in screen) TERM=xterm ;; esac case "${TERM}" in xterm|xterm-color) export LSCOLORS=exfxcxdxbxegedabagacad export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30' zstyle ':completion:*' list-colors 'di=34' 'ln=35' 'so=32' 'ex=31' 'bd=46;34' 'cd=43;34' ;; kterm-color) stty erase '^H' export LSCOLORS=exfxcxdxbxegedabagacad export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30' zstyle ':completion:*' list-colors 'di=34' 'ln=35' 'so=32' 'ex=31' 'bd=46;34' 'cd=43;34' ;; kterm) stty erase '^H' ;; cons25) unset LANG export LSCOLORS=ExFxCxdxBxegedabagacad export LS_COLORS='di=01;34:ln=01;35:so=01;32:ex=01;31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30' zstyle ':completion:*' list-colors 'di=;34;1' 'ln=;35;1' 'so=;32;1' 'ex=31;1' 'bd=46;34' 'cd=43;34' ;; jfbterm-color) export LSCOLORS=gxFxCxdxBxegedabagacad export LS_COLORS='di=01;36:ln=01;35:so=01;32:ex=01;31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30' zstyle ':completion:*' list-colors 'di=;36;1' 'ln=;35;1' 'so=;32;1' 'ex=31;1' 'bd=46;34' 'cd=43;34' ;; esac # set terminal title including current directory # case "${TERM}" in xterm|xterm-color|kterm|kterm-color) precmd() { echo -ne "\033]0;${USER}@${HOST%%.*}:${PWD}\007" } ;; esac ## Prediction configuration # autoload predict-on predict-on ## load user .zshrc configuration file # # [ -f ~/.zshrc.mine ] && source ~/.zshrc.mine
TextMateでの単語単位での移動
TextMateで、単語単位で左右に移動するには、
- ctrl + 左キー、ctrl + 右キー
しか使えないと思って残念と思っていたけど
KeyRemap4MacBook で Emacs風(meta + f, meta + b)に出来た。
KeyRemap4MacBook で、Emacs Mode をいじればOK。
keyboard - Textmate alt-f to move forward by one word - Ask Different
KeyRemap4MacBook 様様 だなぁ。