To send a file:

cat <file> | ssh <user>@<server> "cat > <remote>"

or

ssh <user>@<server> "cat > <remote>" < <file>

To receive a file:

ssh <user>@<server> "cat <remote>" > <local>

1. 字型單位 rem 設定並支援舊時代瀏覽器

單位設定 rem 相似於 em,但其大小並不是依據父元素的值,而是根據 html 標籤的字體大小設定。它擁有 em 相同的好處且不可再擔心混合使用時的問題,因為它只相對於 html 元素來調整大小。但不幸的是IE8 以前的瀏覽器並不支援這個設定。但我們仍可使用這個 mixin 改用 pixel 設定來向後兼容。

1
2
3
4
5
6
7
8
9
@function calculateRem($size) {
$remSize: $size / 16px;
@return $remSize * 1rem;
}

@mixin font-size($size) {
font-size: $size;
font-size: calculateRem($size);
}

使用

1
2
3
p {
@include font-size(14px)
}

輸出

1
2
3
4
p {
font-size: 14px; //Will be overridden if browser supports rem
font-size: 0.8rem;
}
閱讀全文 »

先安裝 Imagemagick 套件

使用 convert 產生 Hald Color LUT (Look Up Table )

convert hald:5 hald.png

將會產生一張 5x5x5 的色彩速查圖 (Hald Image)

我們可將這張圖用任何攝影軟體 (VSCO, Lightroom, Photoshop…等) 套用色彩效果後

閱讀全文 »

CasperJS is a navigation scripting & testing utility for the PhantomJS (WebKit) and SlimerJS (Gecko) headless browsers, written in Javascript.

有趣的線上直播,可以觀看別人寫程式的過程。

Open file: /etc/security/limits.conf:

1
2
3
4
*         hard    nofile      500000
* soft nofile 500000
root hard nofile 500000
root soft nofile 500000

Open file: /etc/mysql/my.cnf:

1
2
open-files-limit        = 1024000
open_files_limit = 1024000

Restart Mysql:
sudo service mysql restart

References

GTD

Getting Things Done 的縮寫,也是 David Allen 的一本書名。

「時間」和「管理」連在一起會誤導人們以為「時間管理」是要對時間進行管理,而時間是無法進行管理的。這一概念實際上意味著它是「管理我們自己的活動,以確保它們是在規定期限內完成,這是一個難以管理的持續的資源」。

— David Allen 2001

  • GTD 的基本理論是把一個人擱在腦中的所有事情從大腦中移出來,記錄到紙上。這樣,大腦便會不被多餘的事情打攪而集中於現在所需完成的事情上面。
  • 同時建立一個可靠的個人時間管理系統,通過收集、整理、組織、回顧與行動五個步驟來有條不紊而高效率地處理個人生活中的所有事情。
  • 強調從小處入手,強調速度和效率,建立了一套工具和方法。

一次只做一件事

flow.png

有一種精神狀態稱為「心流」,它具有以下特點:

  • 明確的目標
  • 集中、專注
  • 自我意識消失
  • 時間感扭曲
  • 直接和即時反饋
  • 能力水平與面對面的平衡
  • 個人控制感
  • 工作本身的內在獎勵
  • 行為與認知的合一

心流是一種創造性的狀態。如果保持心流的狀態,效率不就提高了嗎?不是的,心流狀態下缺乏全局觀念,創造力與統籌力難以並存。時不時地,我需要縱覽全局進行戰略決策,部署行動,以便在下一次的心流期間能夠全身心投入這項行動中。

在進入心流階段之前,我扭動一個番茄鐘,讓它稍後喚醒我,這樣我們以暫時換上戰略眼光,觀察全局,然後再次回到心水流中————就是節奏。

閱讀全文 »

檢查目前 PHP 是用什麼 SSL 版本
php -i | grep "SSL Version"

如果結果如下:

1
SSL Version => SecureTransport

安裝 curl:
brew install --with-openssl curl

重新安裝 PHP

1
2
brew uninstall php55
brew install --with-homebrew-curl --with-homebrew-openssl php55

再重覆第一步驟檢查 SSL 版本:

1
2
$ php -i | grep "SSL Version"
SSL Version => OpenSSL/1.0.2d

Done!

參考


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so

The php.ini file can be found in:
/usr/local/etc/php/5.5/php.ini

✩✩✩✩ PEAR ✩✩✩✩

If PEAR complains about permissions, 'fix' the default PEAR permissions and config:
chmod -R ug+w /usr/local/Cellar/php55/5.5.27_2/lib/php
pear config-set php_ini /usr/local/etc/php/5.5/php.ini system

✩✩✩✩ Extensions ✩✩✩✩

If you are having issues with custom extension compiling, ensure that
you are using the brew version, by placing /usr/local/bin before /usr/sbin in your PATH:

PATH="/usr/local/bin:$PATH"

PHP55 Extensions will always be compiled against this PHP. Please install them
using --without-homebrew-php to enable compiling against system PHP.

✩✩✩✩ PHP CLI ✩✩✩✩

If you wish to swap the PHP you use on the command line, you should add the following to ~/.bashrc,
~/.zshrc, ~/.profile or your shell's equivalent configuration file:

export PATH="$(brew --prefix homebrew/php/php55)/bin:$PATH"

✩✩✩✩ FPM ✩✩✩✩

To launch php-fpm on startup:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/opt/php55/homebrew.mxcl.php55.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php55.plist

The control script is located at /usr/local/opt/php55/sbin/php55-fpm

OS X 10.8 and newer come with php-fpm pre-installed, to ensure you are using the brew version you need to make sure /usr/local/sbin is before /usr/sbin in your PATH:

PATH="/usr/local/sbin:$PATH"

You may also need to edit the plist to use the correct "UserName".

Please note that the plist was called 'homebrew-php.josegonzalez.php55.plist' in old versions
of this formula.


To have launchd start homebrew/php/php55 at login:
ln -sfv /usr/local/opt/php55/*.plist ~/Library/LaunchAgents
Then to load homebrew/php/php55 now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php55.plist