Mac SublimeText3 Package Control導入
Package Control をインストール
「Ctrl + Shift + ` 」でコマンドライン表示
※本当のショートカットは「Ctrl + 」だが「
」はShift無しだと「@」なので
import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
認証付きプロキシの環境でPackage Controlを導入する場合
(参考) 認証付きプロキシの環境でPackage Controlを導入する方法 - Qiita
urllib.request.ProxyHandler()の引数でhttp・httpsのプロキシサーバー関連の設定を行う。
コマンド中の [username] [password] [proxy_server] [port] は、実行する環境に応じて書き換え。
import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler({"http": "http://[username]:[password]@[proxy_server]:[port]", "https": "https://[username]:[password]@[proxy_address]:[port]"})) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
コマンドパレットを表示
Command + Shift + P でコマンドパレット表示
参考
Mac ダイアログをキーボードで選択したい
HomebrewでSublimeText3インストール
sublime-text3はβバージョン扱いだそうで、下記のようにしてインストールする
$ brew tap caskroom/homebrew-versions $ brew cask install sublime-text3
参考
~/.ssh/configでssh接続
~/.ssh/config
を編集
# hogeサーバー Host hoge HostName xxx.xxx.xxx.xxx Port 22 User login-user-name IdentityFile ~/.ssh/keys/hoge.pem
パーミッションで下記のように怒られる場合は、keyファイルの権限を700
にする
$ ssh hoge @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0644 for '/Users/username/.ssh/keys/hoge.pem' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. bad permissions: ignore key: /Users/username/.ssh/keys/hoge.pem Permission denied (publickey).
以上の設定で、
$ ssh hoge
で接続できます
パーミッションについて
-rw-r--r-- -rwxrwxrwx
左から、ファイルタイプ、ユーザー権限、グループ権限、その他のユーザの権限
ファイルタイプの種類
- | ファイル |
d | ディレクトリ |
l | シンボリックリンク |
権限の種類
r | read 読込み権 |
w | write 書込み権 |
x | exec 実行権 |
- | 権限なし |
権限を、ユーザーに全ての権限、グループとその他には実行権限以外をもたせたい場合は、
$ chmod 755 filename
4 | read (読込権) |
2 | write (書込権) |
1 | exec (実行権) |
ディレクトリの所有権を再帰的に変更する場合は、オプション -R を使います。
# chown -hR apache:apache /var/www/wordpress
参考
macをzshに変更
インストールされているか確認
(標準でインストールされています)
$ zsh --version zsh 5.0.5 (x86_64-apple-darwin14.0)
最新化
$ brew install zsh
使用可能なshell一覧/etc/shells
に、brewでインストールしたzsh/usr/local/bin/zsh
を追加
# List of acceptable shells for chpass(1). # Ftpd will not allow users to connect who are not using # one of these shells. /bin/bash /bin/csh /bin/ksh /bin/sh /bin/tcsh /bin/zsh /usr/local/bin/zsh
ログインシェルの確認
$ echo $SHELL /bin/bash
zshに変更
$ chsh -s /usr/local/bin/zsh Changing shell for Username. Password for Username: chsh: no changes made
※chsh: no changes made
と言われた場合、
システム環境設定から変更する
ユーザとグループ > (右クリックで)詳細オプション > 設定後、OKで完了
zshに変更したら、ターミナルを再起動後、ログインシェルの確認
$ echo $SHELL /usr/local/bin/zsh
zshrcを編集
/Users/onoeiko/.zshrc
をお好みで
.zshrcの設定を反映させる
$ source ~/.zshrc
再度ターミナルを起動
jQuery select部品の操作
<select id="day_of_week"> <option value="0">日曜日</option> <option value="1">月曜日</option> <option value="2">火曜日</option> <option value="3">水曜日</option> <option value="4">木曜日</option> <option value="5">金曜日</option> <option value="6">土曜日</option> </select>
月曜日を選択済みにする
$('#day_of_week').val(1).prop('selected',true);
選択済みの項目名を取得する
var dayOfWeek = $('#day_of_week option:selected').text();