2013年12月26日 星期四

[ICA] 演講筆記


電腦動畫概論,演講資料如下:
 
時 間:12月27日星期五 13:20 ~ 15:10
地 點:工程三館EC015
主講人:翁士欽,西基電腦動畫股份有限公司
講 題:From School to Industry–Engineering for Computer Animation
主持人:林文杰 教授
====================

2013年12月25日 星期三

[IOS] HW3 Virtual address translation and COW in fork


這次的作業需求分成兩個 task:

Task 1
Implement a custom system call to translate a virtual address to physical
address.

Task 2
Verify that "fork" uses copy-on-write in the creation of child process address
space.


2013年12月16日 星期一

[SA] Hw4 FAMP(FreeBSD+Apache+MySQL+PHP)










  • # 先從 devel/git 的 ports 中安裝 git
  • # 同時間選取 gitweb 以提供網頁界面
  • # 之後遇到的設定頁照原來的 OK OK 就可以
  • cd /usr/ports/devel/git
  • make install clean
  •  
  • # 增加 git 的使用者,並指定 git 的家用目錄為 /home/git
  • # 同時間使用 git-shell 作為 shell 指令, uid, gid 為 9418
  • pw groupadd -n git -g 9418
  • pw useradd -n git -u 9418 -g git -c git -d /home/git -s /usr/local/libexec/git-core/git-shell -h -
  •  
  • # 新增 repo (倉庫 work),並更改屬性
  • chown git:git /home/git
  • chmod 755 /home/git
  •  
  • mkdir /home/git/work/
  • chmod 775 /home/git/work/
  • chown git:git /home/git/work/
  •  
  • # 設定除了 commit 外還可以使用額外指令的用戶
  • # 如果使用者只需要 commit,就可以不加進來
  • vi /etc/group
  • git:*:9418:zeuxis,neo
  •  
  • # 設定 SSH 認證金鑰,因為 git 要用到這東西
  • # 每個使用者的 SSH Key 也要加進 authorized_keys.
  • # 每個 key 為一行
  • mkdir /home/git/.ssh/
  • chmod 700 /home/git/.ssh/
  •  
  • touch /home/git/.ssh/authorized_keys
  • chmod 600 /home/git/.ssh/authorized_keys
  • chown -R git:git /home/git/.ssh/
  •  
  • # 生成指定用戶的 SSH Key
  • # 在安裝情況下是使用 ssh-keygen -d 生成 dsa
  • # 另還可用 ssh-keygen -t rsa 生成 rsa
  • # 生成時 Enter passphrase 無視按下 enter 即可
  • su username
  • ssh-keygen -d
  • su root
  • cat /home/username/.ssh/id_dsa.pub > /home/git/.ssh/anthorized_keys
  •  
  • # 接著設定 git 的 repo
  • mkdir /home/git/work/test.git
  • cd /home/git/work/test.git && git init --bare --shared
  •  
  • # 接著進行一個簡單的測試
  • mkdir /tmp/test && cd /tmp/test && git init
  • echo "This is a test" > index.html
  • git add
  • git commit -m 'added index.html'
  •  
  • # 之後 commit 到遠端的 repo
  • git remote add origin username@example.com:work/test.git
  • git push origin master
  •  
  • # 之後再設定 gitweb
  • mkdir /home/git/public_html
  • chmod 755 /home/git/public_html
  • chown git:git /home/git/public_html
  • cp /usr/local/share/examples/git/gitweb/git* /home/git/public_html
  •  
  • # 再設定 apache
  • <VirtualHost *:80>
  •   ServerAdmin no-reply@example.com
  •   DocumentRoot "/home/git/public_html"
  •   ServerName git.example.com
  •  
  •   <Directory "/home/git/public_html">
  •     Options ExecCGI
  •     Order allow,deny
  •     Allow from all
  •  
  •     DirectoryIndex gitweb.cgi
  •     AddHandler cgi-script .cgi
  •   </Directory>
  • </VirtualHost>
  •  
  • # 之後再編輯 gitweb.cgi
  • our $projectroot = "/home/git/work";
  • our $home_link_str = "work";
  • our $site_name = "git.example.com"
  • our $projects_list_description_width = 40; # 調整 description 空間
  •  
  • # 修改 test.git 的描述
  • echo "test.git" > /home/git/work/test.git/description
  •  
  • # 修改 test.git 的 owner
  • vim /home/git/work/test.git/config
  •  
  • # 在其後面加入
  • [gitweb]
  • owner = zeuxis
  • url = git://git.example.com/work/test.git
  • url = username@git.example.com:work/test.git
  •  
  • # 最後就是設定 Git protocol
  • # 在 /etc/rc.conf 最後加入這段
  • git_daemon_enable="YES"
  • git_daemon_directory="/home/git"
  • git_daemon_flags="--syslog --base-path=/git --export-all"
  •  
  • # 之後啟動 Git Daemon
  • /usr/local/etc/rc.d/git_daemon start
  •  
  • # 如果以上面這句子會出現停在 starting 的字眼可以改為以下句式
  • # 送出後接兩下 Enter 結束即可
  • /usr/local/etc/rc.d/git_daemon start &
  •  
  • # 檢查是否在執行
  • ps -eaf | grep -v grep | grep git
  •  
  • # 如有東西就可以再測試可否使用了
  • cd /tmp/test
  • rm -Rf *
  • git clone git://git.example.com/work/test.git
  • - See more at: http://www.chair.im/?p=597#sthash.2F0agDtP.qSAdRJ2D.dpuf

    Requirement

    • To do this homework , you need 2 domain name.
      • http://twbbs.org/
      • http://www.nctucs.net/
    • You need two hostnames use same IP address.
    • When access http://yourdomain1, it will show the php information.
    • When access http://yourdomain1/sademo.html, it will show the text “This page is for sa demo.”. 
      • Notice that user can use both http and https portocal to access this page.
    • When access http://yourdomain1/private/, user need enter id "nctucs" and password "sahw4" which is implemented by .htaccess. And it will show the text “It’s my secret.”
    • System user sysadm can put file at ~/WWW/ and others can access it by visiting http://yourdomain1/~sysadm/. sysadm's password is your student id.
    • Your git website url is http://yourdomain2/gitweb
    • For demo, you need to put a git repository named “sademo.git”. And it’s decription is “This repository is for sa demo.”.
    • On your website, enter the sademo.git will show URL information, it’s URL is http://yourdomain2/gitweb/sademo.git.
    • You can clone and push your repository by http://yourdomain2/gitweb/sademo.git and password is your student id.
    • Users use cookie authentication when access your phpMyAdmin site http://yourdomain1/phpMyAdmin/
      • (You need to add a MySQL user for authentication).
      • Create another user with limited privilege
      • And notice that if others access http://yourdomain2/phpMyAdmin/, they can not access it.
      • Only 140.113.*.* can access it
      • But 140.113.235.* can’t access it
    • Redirect http://yourdomain1/ILoveSA to http://help.cs.nctu.edu.tw/ 
      • But http://yourdomain2/ILoveSA will not redirect .

    2013年12月2日 星期一

    [SA] Hw3 shell programming



    因為這次都是寫 code ,所以我這次就把 code 丟上 GitHub

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