製作 OSX Yosemite DVD iso image

筆記一下

hdiutil attach /Applications/Install\ OS\ X\ Yosemite.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil convert /Volumes/install_app/BaseSystem.dmg -format UDSP -o /tmp/Yosemite
hdiutil resize -size 8g /tmp/Yosemite.sparseimage
hdiutil attach /tmp/Yosemite.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build
rm /Volumes/install_build/System/Installation/Packages
cp -rp /Volumes/install_app/Packages /Volumes/install_build/System/Installation/
cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/install_build
cp -rp /Volumes/install_app/BaseSystem.dmg /Volumes/install_build
hdiutil detach /Volumes/install_app
hdiutil detach /Volumes/install_build
hdiutil resize -size `hdiutil resize -limits /tmp/Yosemite.sparseimage | tail -n 1 | awk '{ print $1 }'`b /tmp/Yosemite.sparseimage
hdiutil convert /tmp/Yosemite.sparseimage -format UDTO -o /tmp/Yosemite
rm /tmp/Yosemite.sparseimage
mv /tmp/Yosemite.cdr ~/Desktop/Yosemite.iso

不用再按 reload 了: LiveReload

每次網頁改來改去要一直按 reload 真的很麻煩
還是來裝一下 LiveReload 好了

瀏覽器安裝外掛

依照瀏覽器安裝 LiveReload 外掛
不要去瀏覽器官網列表裝 可能會是舊版的

Sublime Text3

到 Package 資料夾使用 git 安裝

OSX

cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/
rm -rf LiveReload
git clone -b devel https://github.com/dz0ny/LiveReload-sublimetext2.git LiveReload

Windows

須先安裝 git (不然自己下載檔案 放進 package 也是可以)

執行 cmd

cd "C:\Users\使用者\AppData\Roaming\Sublime Text 3\Packages"
rd /s /q LiveReload
git clone -b devel https://github.com/dz0ny/LiveReload-sublimetext2.git LiveReload

啟動

如果裝完之後不會連動
打開 sublime
cmd(ctrl)+shift+p
LiveReload: Enable/disable plugins
Enable – SimpleReload
應該就可以做動了

參考資料
http://livereload.com/extensions/
https://github.com/dz0ny/LiveReload-sublimetext2
https://github.com/dz0ny/LiveReload-sublimetext2/issues/78

Firefox 安裝行政院憑證

ff_ca01

Firefox 31以上版本瀏覽政府網站(https) 會出現安全連線失敗

連線到 — 時發生錯誤。 節點的憑證有無效的簽章。
(錯誤碼: sec_error_bad_signature)

這是因為行政院新的憑證 並沒有列入 Firefox 的預設憑證清單裡面

解決方法很簡單 就匯入就好了

但是 身為一個暴民 還是要說一下

** 警語 匯入政府相關憑證 所產生之風險請自行評估 **

Read more

做網頁的好幫手 emmet

上週在看做網頁的一些教學 發現怎麼人家做網頁跟D3刷寶一樣快
原來是用了 emmet 這個神外掛
裝了之後 只要在編輯器打上

[code]
#page>div.logo+ul#navigation>li*5>a{Item $}
[/code]

按一下指定熱鍵(依照編輯器與平台不同)
就會轉換為

[code language=”html”]
<div id="page">
<div class="logo"></div>
<ul id="navigation">
<li><a href="">Item 1</a></li>
<li><a href="">Item 2</a></li>
<li><a href="">Item 3</a></li>
<li><a href="">Item 4</a></li>
<li><a href="">Item 5</a></li>
</ul>
</div>
[/code]

Read more

Apache 更新至 2.4 幾個小問題

Debian 更新 Jessie 之後 Apache 也順道升級到 Apache 2.4
不過因為之前的設定不符新版本的規範 要修正幾個地方

a2ensite 啟動錯誤

$ sudo a2ensite blog

ERROR: Site blog does not exist!

這是因為設定檔必須加副檔名 .conf

mv /etc/apache2/sites-available/blog /etc/apache2/sites-available/blog.conf

啟動爆炸

$ sudo service apache2 start
Job for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details.

然後去找一下問題

sudo systemctl status apache2.service                                                  1 ↵
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
   Active: failed (Result: exit-code) since Mon 2015-04-27 14:49:01 CST; 2min 59s ago
  Process: 13061 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 10368 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
  Process: 13114 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Apr 27 14:49:01 de apache2[13114]: Starting web server: apache2 failed!
Apr 27 14:49:01 de apache2[13114]: The apache2 configtest failed. ... (warning).
Apr 27 14:49:01 de apache2[13114]: Output of config test was:
Apr 27 14:49:01 de apache2[13114]: AH00526: Syntax error on line 5 of /etc/apache2/sites-enabled/blog.conf:
Apr 27 14:49:01 de apache2[13114]: Either all Options must start with + or -, or no Option may.
Apr 27 14:49:01 de apache2[13114]: Action 'configtest' failed.
Apr 27 14:49:01 de apache2[13114]: The Apache error log may have more information.
Apr 27 14:49:01 de systemd[1]: apache2.service: control process exited, code=exited status=1
Apr 27 14:49:01 de systemd[1]: Failed to start LSB: Apache2 web server.
Apr 27 14:49:01 de systemd[1]: Unit apache2.service entered failed state.

解決方式 把設定檔裡面的 Option 後面加上 + –

Options +FollowSymLinks -Indexes

權限也爆炸了

終於啟動了 但是怎麼看都是 Forbidden

回頭看一下log

You don't have permission to access / on this server.
[Mon Apr 27 14:40:44.662774 2015] [authz_core:error] [pid 12400] [client 192.168.1.199:50394] 
AH01630: client denied by server configuration: /home/web/htdocs/index.php

因為我 DocumentRoot 沒有放在 /var/www/html 下面
所以爆炸了
解決方式是在 Directory 區段內加入 Require all granted
例如

[code highlight=”3″]
<Directory />
Options +FollowSymLinks -Indexes
Require all granted
</Directory>
[/code]
再重新啟動就好了

apache2.4文件是這麼寫的

—
2.2 configuration:

Order allow,deny
Allow from all

2.4 configuration:

Require all granted

FreeBSD gettext 更新問題

筆記一下 gettext 衝突

Installing gettext-runtime-0.19.4...
pkg-static: gettext-runtime-0.19.4 conflicts with gettext-0.18.3.1_1 (installs files into the same place). 
Problematic file: /usr/local/bin/envsubst
*** Error code 70

Stop.
make: stopped in /usr/ports/devel/gettext-runtime

成因:

  The devel/gettext port has been split up in devel/gettext-runtime, a
  lightweight package containing runtime libraries, and devel/gettext-tools,
  a package containing developer tools.  The devel/gettext port still exists
  as a metaport.

  You must first delete the existing installation of gettext and then
  reinstall it.  This will break sudo, so you *must* do this in a root
  shell (sudo -i) if you use sudo.

解決方法

pkg delete -f gettext

參考資料 https://github.com/freebsd/freebsd-ports/blob/master/UPDATING

Firefox dark theme

ff03

UPDATE: 改用這個addon就好了

Firefox 的開發者版本 Developer Edition 是預設暗色主題, 這種黑色系的對宅宅來說 真是一種致命的吸引力
可是 Developer Edition 是走 Aurora channel 並非正式發行版本的 channel 這穩定度來說稍差了點
之前想說應該還ok, 結果測試了一兩個月 出問題的機率比想像中的還高 只好淚砍

這兩天想 應該還是有辦法把那個黑化主題弄過來 找一下資料 果然有 而且方法超簡單 其實正式發行版本本來就內含

Read more