2017年4月20日星期四

Nginx enable http2

Nginx enable http2

change Nginx config

listen 443 ssl http2

mac curl

curl -I --http2 https://www.cloudflare.com/
curl: (1) Unsupported protocol

brew install --force curl --with-nghttp2
~ yan% brew link curl
Warning: curl is keg-only and must be linked with --force
Note that doing so can interfere with building software.

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.zshrc
~ yan% brew link --force curl
Linking /usr/local/Cellar/curl/7.54.0... 377 symlinks created

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.zshrc

Nginx enable http2

change Nginx config

listen 443 ssl http2

mac curl

curl -I --http2 https://www.cloudflare.com/
curl: (1) Unsupported protocol

brew install --force curl --with-nghttp2
~ yan% brew link curl
Warning: curl is keg-only and must be linked with --force
Note that doing so can interfere with building software.

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.zshrc
~ yan% brew link --force curl
Linking /usr/local/Cellar/curl/7.54.0... 377 symlinks created

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.zshrc

Ignore git file mode

When you sync a git repo to windows, the mode of the files will changed to 755, which is 644 under linux. Git will treat these files as modified and need commit. GIt can be configured ignoring this changes by execute following command:

git config core.fileMode false
When you sync a git repo to windows, the mode of the files will changed to 755, which is 644 under linux. Git will treat these files as modified and need commit. GIt can be configured ignoring this changes by execute following command:

git config core.fileMode false

2016年10月27日星期四

Filter certain files from the explorer in visual studio code

- open Preferences > User Settings
- add "file.excludes" {...} settings

for example:
    "files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/.DS_Store": true
        } 
- open Preferences > User Settings
- add "file.excludes" {...} settings

for example:
    "files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/.DS_Store": true
        } 

2016年10月24日星期一

Enable repeat input when keep pressing keyboard in OSX

When i keep pressing keyboard in Sublime Text and Visual Studio Code ,i found the input doesn't repeat, even after i set the repeat settings in system preferences. After searching, i found a command which can enable this function.
defaults write -g ApplePressAndHoldEnabled -bool false
When i keep pressing keyboard in Sublime Text and Visual Studio Code ,i found the input doesn't repeat, even after i set the repeat settings in system preferences. After searching, i found a command which can enable this function.
defaults write -g ApplePressAndHoldEnabled -bool false

2016年10月19日星期三

Install python-lzo on osx

- install lzo
$ brew intall lzo

- download python-lzo
$ wget https://pypi.python.org/packages/26/d2/6d118e3b8d29b61d75dc9279ae8233915aaefaa630f6a6ad3b9924147367/python-lzo-1.08.tar.gz\#md5\=5fa6fb70428dcf3318d104ae192ad5c9

- uncompress python-lzo
$ tar zxvf python-lzo-1.08.tar.gz

- edit setup.py
add these lines after line 29 libraries = ["lzo2"]

<blockquote>include_dirs.append("/usr/local/include/")
library_dirs.append("/usr/local/lib")</blockquote>


- edit lzomodule.c
replace #include <lzo1x.h> with #include <lzo/lzo1x.h>

- install
sudo -H python setup.py install


PS:
During the process of installing python-lzo, i got some errors such as:
- lzomodule.c:35:10: fatal error: 'lzo1x.h' file not found
- ld: library not found for -llzo2
- ld: can't open output file for writing 'build/lib.macosx-10.12-x86_64-2.7/lzo.so.ld_z7QuBz', errno=13 for architecture x86_64

If you have encountered same error, this article may be help.
- install lzo
$ brew intall lzo

- download python-lzo
$ wget https://pypi.python.org/packages/26/d2/6d118e3b8d29b61d75dc9279ae8233915aaefaa630f6a6ad3b9924147367/python-lzo-1.08.tar.gz\#md5\=5fa6fb70428dcf3318d104ae192ad5c9

- uncompress python-lzo
$ tar zxvf python-lzo-1.08.tar.gz

- edit setup.py
add these lines after line 29 libraries = ["lzo2"]

<blockquote>include_dirs.append("/usr/local/include/")
library_dirs.append("/usr/local/lib")</blockquote>


- edit lzomodule.c
replace #include <lzo1x.h> with #include <lzo/lzo1x.h>

- install
sudo -H python setup.py install


PS:
During the process of installing python-lzo, i got some errors such as:
- lzomodule.c:35:10: fatal error: 'lzo1x.h' file not found
- ld: library not found for -llzo2
- ld: can't open output file for writing 'build/lib.macosx-10.12-x86_64-2.7/lzo.so.ld_z7QuBz', errno=13 for architecture x86_64

If you have encountered same error, this article may be help.

2016年10月14日星期五

AVPlayer

Today i try to use AVPlayer to play a m3u8 file, but the video can't play, it showed a forbidden icon at the center. At first i thought it's the https issue. Then i added http setting in the info.plist file, it's still not working. After i changed a couple of m3u8 files, it turned out that is was the m3u8 file format.
Today i try to use AVPlayer to play a m3u8 file, but the video can't play, it showed a forbidden icon at the center. At first i thought it's the https issue. Then i added http setting in the info.plist file, it's still not working. After i changed a couple of m3u8 files, it turned out that is was the m3u8 file format.

2016年10月13日星期四

Learning swift

I having been learning swift a couple of days, i found it is much easyer than object c. I planed to build a app for englinsh learning , i got this idea months ago.
I having been learning swift a couple of days, i found it is much easyer than object c. I planed to build a app for englinsh learning , i got this idea months ago.