Owncloud 4 and AD LDAP

[ownCloud] Owncloud 4 and AD LDAP on Windows
LDAP configuration

-LDAP Basic
Host: IP or Resolvable DNS
Base DN: dc=DOMAIN,dc=TLD
User DN: user@domain.tld
Password: password
User Login Filter: sAMAccountName=%uid
User List Filter: objectClass=user
Group Filter objectClass=group

-Advanced
Port: 389
Case insensitive LDAP server (Windows) checked
The Group Member association must be set to “member (AD)”
Display Name Field: sAMAccountName

資料來源: http://it.thelibrarie.com/weblog/2012/07/owncloud-4-and-ad-ldap/
http://owncloud.org/support/ldap-backend/ldap-backend-in-owncloud-4-5/

廣告

Rails RESTful helper

GET
<%= link_to(“List", posts_path) %> #index
<%= link_to(“Show", post_path(@post)) %> #show
<%= link_to(“New", new_post_path) %> #new
<%= link_to(“Edit", edit_post_path(@post)) %> #edit

POST
<%= form_for @post , :url => posts_path , :html => {:method => :post} do |f| %> #create

PUT
<%= form_for @post , :url => post_path(@post) , :html => {:method => :put} do |f| %> #update

Delete
<%= link_to(“Destroy", post_path(@post), :method => :delete ) #destroy

讓 Sublime Text 也擁有 “Navigate to Definition" 功能 (設定 CTags)

http://ascendbruce.logdown.com/posts/179064-sublime-text-integration-with-ctags

安裝好ctags及Sublime ctags plugin後
執行:ctags -R -f .gemtags $(bundle list --paths)

OSI TCI/IP

https://dl.dropboxusercontent.com/u/30461685/osi_tcpip.gif

VS2012 Git頁面功能一覽

1.Home:
i).Changes – 跳到2
ii).Unsynced Commits – 看目前Local與Remote的差異
<加過Remote Repository URL>:
a.Sync – 同步Local與Remote(自動抓最新的Commit)
b.Pull – 把Remote拉回Local
c.Push – 把Local推送到Remote
d.Actions
Open in File Explorer – 打開專案目錄
Open Command Prompt – 打開cmd.exe
View History – 看Git Log
e.Incomming Commits – 還沒Push到Remote的Commit
f.Outgoing Commits – 已與Remote同步的Commit
<沒加過Remote Repository URL>:
e.Publish to Remote Repository – 輸入Remote URL,必須是HTTP(S)協定!SSH還不支援,詳見LibGit2Sharp相關討論。(補充: 儲存credential的方法: git config credential.helper store,刪除: git config –unset credential.helper;若是Windows可以利用git-credential-winstore小工具,它會幫你儲存到控制台→使用者帳戶→管理您的認證。資料來源)
iii).Branches
a.Changes – 跳到2
b.Unsynced Commits – 跳到ii
c.New Branch – 新增Branch、輸入Branch Name
d.Merge Branch – 合併Branch
e.Actions – 跳到1.ii.d
f.Published Branch – Remote的Branch List
g.Unpublished Branch – Local的Branch List
iv).Settings – 跳到3

2.Changes: 看目前Local尚未Commit的檔案
i).Commit – 輸入Commit message
a.Commit – 提交到Local
b.Commit and Push – 提交並Push
c.Commit and Sync – 提交並Push & Pull
d.Actions – 跳到1.ii.d
e.Included Changes – Local已做Git Add、尚未Commit的檔案
f.Excluded Changes – Local已做Git Add、不打算Commit的檔案
g.Untracked Files – Local尚未做Git Add的檔案

3.Settings:
i).Git Settings
Global Settings –
設定 User Name、Email Address、Default Repository位置
Repository Settings –
設定 Ignore File、Attribute File

參考資料:http://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c

常用權限列表

r: 4
w: 2
x: 1

範例:
owner = rwx = 4+2+1 = 7
group = rwx = 4+2+1 = 7
others= — = 0+0+0 = 0

-rw——- (600) — 只有owner有讀寫權限。

-rw-r–r– (644) — 只有owner有讀寫權限;而群組用戶和其他用戶只有讀權限。

-rwx—— (700) — 只有owner有讀、寫、執行權限。

-rwxr-xr-x (755) — owner有讀、寫、執行權限;而群組用戶和其他用戶只有讀、執行權限。

-rwx–x–x (711) — owner有讀、寫、執行權限;而群組用戶和其他用戶只有執行權限。

-rw-rw-rw- (666) — 所有用戶都有文件讀、寫權限。

-rwxrwxrwx (777) — 所有用戶都有讀、寫、執行權限。

[轉] 安裝乾淨的Rails環境在OS X

1. Command Line Tools

Install Package or “xcode-select –install” from terminal

2. Homebrew

$ ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
$ brew install automake

3. RVM

$ \curl -L https://get.rvm.io | bash -s stable --ruby
$ source ~/.rvm/scripts/rvm

4. Ruby 1.9.3

$ rvm install 1.9.3-head
$ rvm use ruby-1.9.3-head

5. Rails

$ gem install rails

6. Git

brew install git

7. MySQL

$ brew install mysql
$ mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
$ mkdir -p ~/Library/LaunchAgents
$ cp /usr/local/Cellar/mysql/5.5.27/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

資料來源:https://coderwall.com/p/auvm9g
http://carolhsu.github.io/blog/2012/11/07/an-zhuang-gan-jing-de-railshuan-jing-zai-os-x-10-dot-8-rvm-plus-postgresql/

Mac 終端機常用熱鍵

Tab: 自動補齊指令全名
按兩下Tab: 列出有相同開頭的指令
Control + U: 刪除游標到最前面整行
Control + K: 刪除游標到最後面整行
Control + L: 清空畫面,等同 Clear (或 Command + K)
Control + A: 游標移到最前面
Control + E: 游標移到最後面
Option + Click: 游標移到滑鼠點的地方
Command + N: 新增視窗
Command + T: 新增分頁
Command + W: 關閉目前視窗或分頁
Command + S: 儲存成文字檔
Command + shift + { 或 }: 切換分頁

==============================================

Mac 下設置PATH:

1 首先查看PATH
命令:$PATH

2 如何设置PATH
命令:echo “export PATH=xxxxxx:$PATH" >> ~/.bash_profile
解释:把"export PATH=xxxxxx:$PATH"输出打印到~/.bash_profile中去。

3 Unix知识补充:~/.bash_profile介绍
mac和linux终端一般用bash来进行解析。当bash在读完了整体环境变量的/etc/profile并借此调用其他配置文件后,接下来则是会读取用户自定义的个人配置文件。bash读取的文件总共有三种:

~/.bash_profile   ~/.bash_login    ~/.profile

其实bash再启动是只读上面文件的一个,而读取的顺序则是依照上面的顺序。也就是说读到bash_profile就不读后面的了,如果bash_profile不存在,后面的才能有机会。让我们来看看bash_profile里面有什么内容:

命令:cat ~/.bash_profile

==============================================

Mac 常用基本指令可見 http://andytaylor.me/2012/11/03/unix-command-line-usage-notes/

[轉] Git-rebase 小筆記

http://blog.yorkxin.org/posts/2011/07/29/git-rebase
補充: 再搭配ihower這個影片

GitLab Nginx設定檔範例

# GITLAB
# Maintainer: @randx
# App Version: 5.0

upstream gitlab {
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}

server {
listen *:8000 default_server; # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea
server_name localhost; # e.g., server_name source.example.com;
server_tokens off; # don’t show the version number, a security best practice
root /home/git/gitlab/public;

# Set value of client_max_body_size to at least the value of git.max_size in gitlab.yml
client_max_body_size 5m;

# individual nginx logs for this gitlab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;

location / {
# serve static files from defined root folder;.
# @gitlab is a named location for the upstream fallback, see below
try_files $uri $uri/index.html $uri.html @gitlab;
}

# if a file, which is not found in the root folder is requested,
# then the proxy pass the request to the upsteam (gitlab unicorn)
location @gitlab {
proxy_read_timeout 300; # Some requests take more than 30 seconds.
proxy_connect_timeout 300; # Some requests take more than 30 seconds.
proxy_redirect off;

proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_pass http://gitlab;
}
}

========

GitLab相關設定檔:
/home/git/gitlab/config/gitlab.yml #gitlab web的initialier會載入(*註1)
/home/git/gitlab-shell/config.yml #gitlab unicorn會載入(*註2)
/etc/nginx/sites-available/gitlab #設定nginx for gitlab

*註1: 重啟方法 service nginx restart
*註2: 重新載入 sudo /etc/init.d/gitlab reload/stop (or sudo service gitlab stop)