Add Git SHA1 property in Apache ANT build.xml

Create git.SHA1 property in build.xml file. <available file=".git" type="dir" property="git.present"/> <target name="git.info" description="Store git info" if="git.present"> <exec executable="git" outputproperty="git.SHA1" failifexecutionfails="false" errorproperty=""> <arg value="log"/> <arg value="--pretty=oneline"/> <arg value="-n1"/> </exec> <condition property="git.version" value="${git.SHA1}" else="unknown"> <and> <isset property="git.SHA1"/> <length string="${git.SHA1}" trim="yes" length="0" when="greater"/> </and> </condition> <echo message="print git log : " /> <echo message="${git.SHA1}" /> </target> Reference: How to lookup the latest git commit hash from an ant build script

June 13, 2013 · 1 min · oopsmonk

Nginx Error - 413 Request Entity Too Large

nginx version: nginx/1.1.19, OS: Ubuntu12.04 Default nginx accepted body size limitation is 1MB. You can add client_max_body_size in nginx.conf. This parameter can put in http, server and location sections of configutation file. Enlarge body size to 10MB client_max_body_size 10M Or just disable it client_max_body_size 0 For example enlarge body size to 10MB Add to http section: $ sudo vi /etc/nginx/nginx.conf http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; client_max_body_size 10M; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ... } Or modify server and location section ...

June 5, 2013 · 1 min · oopsmonk

AWS S3 Download Bucket Folder

Currently, AWS web console not provide folder downloading. We can use s3cmd or s3Browser for this purpose. s3Browser is a freeware Windows client for S3 and CloudFront. s3cmd download Bucket folder: s3cmd sync s3://bucketname/folder /local/folder For download files using s3Browser, here is a tutorial. Uploading and Downloading Files to and from Amazon S3

May 28, 2013 · 1 min · oopsmonk

Web Micro Framework Battle

WSGI Micro Framworks 這陣子一直在找適合的Micro Framwork玩第一次的Web Application. 最後選擇用Bottle, 原因是: Single file module, no dependencies with other library. Document 但是好不好用又是另一回事, 用了就知道..XD 以下是由WSGI.org列出的Micro Framwork: bobo Bobo is a light-weight framework. Its goal is to be easy to use and remember. Bottle Bottle is a fast and simple micro-framework for small web-applications. It offers request dispatching (Routes) with url parameter support, Templates, key/value Databases, a build-in HTTP Server and adapters for many third party WSGI/HTTP-server and template engines. All in a single file and with no dependencies other than the Python Standard Library. ...

May 27, 2013 · 1 min · oopsmonk

Pandoc's Markdown Reference

#### [2015-02-12]This article doesn't render properly since I switched from Google Blogger to Github Pages. I won't fix this problem. Pandoc實現了基本的Markdown語法外, 還加了一些extention. 細節可參考: [Pandoc's Markdown][pmd] [Markdown語法][mdsyntax] [Markdown:Syntax][mds] [Pandoc Markdown and ReST Compared][MDcmpReST] Headers (Setext and atx) Setext-style只有兩階也就是HTML語法裡的h1及h2 tag,-跟=的個數沒有限制. atx-style共有6階, h1~h6. # This is H1. ## This is H2. ### This is H3. #### ... ###### This is H6. 除了階層較多之外, atx-style還可以使用Markdown syntax. ###This is *H3* header. Output: This is H3 header. Inline Formatting Basic Emphasis 斜體字: *, _ , 粗體字: **, __, ...

May 23, 2013 · 7 min · oopsmonk

uWSGI & Nginx on Ubuntu

Install uWSGI Configure uWSGI $ sudo apt-get install python-dev python-pip $ sudo pip uwsgi ################# uWSGI configuration ################# pcre = False kernel = Linux malloc = libc execinfo = False ifaddrs = True ssl = True matheval = False zlib = True locking = pthread_mutex plugin_dir = . timer = timerfd yaml = True json = False filemonitor = inotify routing = False debug = False zeromq = False capabilities = False xml = expat event = epoll ############## end of uWSGI configuration ############# *** uWSGI is ready, launch it with /usr/local/bin/uwsgi *** Successfully installed uwsgi Cleaning up... $ Test uWSGI Create test file called hello.py: ...

May 21, 2013 · 1 min · oopsmonk

About Markup

Markup Language 寫文件或blog最困擾的就是排版, 大略看一下目前較流行的Markdown & reStructuredText, 決定用Markdown來寫, rst給我的感覺就是要再學另一種語言, 雖然強大, 但我只要夠用就好, 必竟都有人用Markdown寫書了 XD. Markdown Setup 目前是用Vim + Pandoc來寫Markdown, 網路上也有Web editor, 或是windows平台的Markdownpad, 但Web用起來不順手, Markdownpad不能跨平台. 用Vim麻煩的是preview, 寫完要手動用Pandoc轉成html, 之後直接將轉出來的html, 直接貼到blogger. 一般沒有CSS的用法: $ pandoc README.md -o out.html 加入CSS依文件的方法是: $ pandoc -c markdown.css README.md -o out.html 但是會有一個問題, 貼上blogger時會無法正常顯示, 原因在於html裡是這樣寫的: <link rel="stylesheet" href="markdown.css" type="text/css" /> 後來想到了一個workaround, 用-H參數將CSS放入Header, 但也不是直接帶入, 需要將一般的CSS file用style tag包起來, 如下: <style type="text/css"> Your CSS syntax.... </style> 另存成pandoc-markdown.css, 如此才是真正的__fully standalone__. $ pandoc -H pandoc-markdown.css README.md -o out.html Vim Tips 修改vimrc將*.md標示為Markdown格式, 存檔自動產生HTML檔案. ...

May 21, 2013 · 1 min · oopsmonk