2014年10月23日 星期四

[git]列出更改該commit 更改的檔案 / show commit changed files



 有時想看該commit改了什麼檔案,又不想秀出該commit的內容。
使用 git show 會秀出 commit 的內容。

git show [commit_id] --name-only

ex
git show 8637187 --name-only


141023 吳式太極拳 發力方式



今天練完拳跟老師提到,週日那天溫師兄分享的發力的結構跟方式,好像跟老師的不太一樣。
老師,笑一了下,沉思,說,這就是鬆沉,然後擺出鬆沉的架勢。
(攬雀尾樣)

他呵呵的說,這東西沒有什麼絕對的對錯,你要多練多用心體會,看看你自己的體會是如何?


這樣的對話是集富哲理的,讓我能夠再往更深的一層去。



2014年10月17日 星期五

[book] 引爆趨勢 引爆點的三大原則



引爆點的三大原則


  • 少數原則
在特定的過程及體系內,少數才是關鍵。
  • 定著因素
代表這則訊息發生作用,它留在你的腦海中,揮之不去。
  • 環境力量

2014年10月3日 星期五

140928 (日) 吳式太極拳 推手初探

140928 (日) 吳式太極拳 推手初探

今天去練拳,先練習了一下拳架。
後來老師就先跟師兄推一下手,推一陣子後就問我來推一下吧。

看了好幾個月,師兄跟老師的推手,在這段期間內,我也對照 吳鑑泉 宗師 的拳架推手。

老師今天講的是基本的推手,四動,先右腳在前,攻右手,再攻左手,對方攻過來,左轉腰,坐腿,再攻過來,坐腿轉腰。

這動作僅可雙練,也可單鏈,更可以先訓練姿勢正確,先不在守時變換。不然守的時候可以捋。


- 槍型推手心得
這推手方式就像是槍型推手,先讓自己姿勢正確能夠弓腿坐腿。
在拳架上面也更能體會奧祕。

- 單人也可練


老師還問說網路上面有 吳大揆的影片嗎
我就找了現在比較常看到的兩段,一段是草皮推手,一段是家裡推手跟太極劍。

老師也說,吳家的跤會這麼厲害就是全佑本身就是摔跤大王,才能進宮去當皇上的侍衛。
(這方面來說應該是楊露禪在王府教拳,有其他滿人的侍衛。)

一看影片老師就說,對對對這大揆。

2014年9月27日 星期六

[武術]140927 (六) 吳式太極拳 練習的階段與學習的過程



今天去的時候已經打到快結束拳套了。
老師請我自己動動,我打了兩次拳套請老師指點。

呼呼,不過昨天晚睡早上精神不太好,反而忘了第一段的連續動作。有點小傷心。

老師有多提到,練拳的過程,不是你拳套動作,跟你講一次或者是錄完一次,就完結了。
而是一次次,又聽越熟,自己從練到動作正確,熟練以後,慢慢體會用法用意,每一次都有不同的所思所得,所以這是個持續進步的過程。

提到了吳大揆 師伯的說法,他說,"我們一代不如一代,鑑泉不如全佑,而我老爸又不如鑑泉,而我差我老爸又差很遠了。可是,還是所向無敵,如果遇到更高的,我就要更苦練,練的更高。"

老師講的練拳與追求的過程,讓我陷入了一個沉思,剛好與最近的狀態做了一個相呼應。

"老實練拳~" 或許是這階段的一個啟示。


今天老師指點了抱虎歸山的用法用意,一步步的修正他。
會後,老師也說了下次可以早點來練習。

[mac]wxpython install



brew install wxmac


ImportError: No module named html2

2014年9月16日 星期二

[elasticsearch] insert automatically timestamp filed to document 自動加入 timestamp



有個需求是,如果再index records的同時加入index 的時間呢?

logstash會在欲index 的 event 加入 @timestamp 欄位,是由 logstash所加入的。

elasticsearch 的 mapping 內有個 _timestamp ,只要在 put mapping 時 啟用這個欄位,索引時就會自動把索引時間加入 records中。

用法如下,
{
    "logs" : {
        "_timestamp" : { "enabled" : true }
    }
}

_timestamp 欄位預設在 index setting中 "store" 是設為 false , "index" 屬性設為 not_analyzed 。

create index
PUT http://localhost:9200/indextest

  • put mapping

PUT http://localhost:9200/indextest/logs/
{
    "logs" : {
        "_timestamp" : { "enabled" : true }
    }
}

  • post data to index

POST http://localhost:9200/indextest/logs
{
    "name" : "elasticsearch"
}

  • search docs
GET http://localhost:9200/indextest/logs/_search?q=*&fields=_timestamp,_source

{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "indextest",
"_type": "logs",
"_id": "0AXft-9gTK-DUdfEvUZFiQ",
"_score": 1,
"_source": {
"name": "elasticsearch"
},
"fields": {
"_timestamp": 1410870337057
}
}
]
}
}



cf.
peicheng-note: elasticsearch 相關 elasticsearch文章
http://peichengnote.blogspot.tw/search/label/elasticsearch
_timestamp
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html
peicheng note: [elasticsearch]get all facet term in elasticsearch / 得到所有的aggregation term list
http://peichengnote.blogspot.tw/2014/09/elasticsearchget-all-facet-term-in.html
peicheng note: [elasticsearch]safely reload configuration from elasticsearch.yml
peicheng note: [elasticsearch] url query_string length limit
peicheng note: [elasticsearch] 關於 brain split / cluster split 成兩個 clusters
peicheng note: [elasticsearch] 再談 _all field
http://peichengnote.blogspot.tw/2014/06/elasticsearch-all-field.html
peicheng note: [elasticsearch]range query depends on the field type
http://peichengnote.blogspot.tw/2014/06/elasticsearchrange-query-depends-on.htmlpeicheng-note: [elasticsearch] document id _id field uuid
http://peichengnote.blogspot.tw/2014/05/elasticsearch-document-id-id-field-uuid.html
peicheng-note: [elasticsearch/logstash] logstash id 自動產生 document id "_id" automatic id generation
http://peichengnote.blogspot.tw/2014/04/elasticsearchlogstash-logstash-id.html
peicheng note: [elasticsearch] index size , shard size , heap size design
http://peichengnote.blogspot.tw/2014/07/elasticsearch-index-size-shard-size.html
peicheng note: [Elasticsearch] NumberFormatException / Invalid shift value in prefixCoded bytes

2014年9月14日 星期日

[日記]2014.09.13(六) 紀錄片播映 | 楊牧:朝向一首詩的完成



活動訊息

====
9/13(六) 19:00~21:00  紀錄片播映 | 楊牧:朝向一首詩的完成
於 國家圖書館3F國際會議廳 舉辦(北市中山南路20號)

【 活動說明 】
1. 紀錄片播映會將於 9/13(六)18:30 開放報名民眾自由入座,19:00準時播放。

期待與您的見面。

趨勢教育基金會

====

  • 原來楊牧的影響不只深植在我心中,還有這麼多當代現代詩人出來現身說法,除了那提攜後進,與開創新的漢詩新局。 裡面有句話說的很棒,楊牧的生活與家人維護的平靜,讓他有平靜的內心能量做狂野的創作。 整個紀錄片看來好衝擊...

2014年9月11日 星期四

[ruby][WARNING] MultiJson is using the default adapter (ok_json).We recommend loading a different JSON library to improve performance.

[WARNING] MultiJson is using the default adapter (ok_json).We recommend loading a different JSON library to improve performance.

[linux]monitor your process network / iftop / NetHogs 監控程序流量


想要再Linux看到網路的流量可以使用

cat /sys/class/net/eth0/statistics/rx_bytes
or
cat /sys/class/net/eth0/statistics/tx_bytes

若是想更直覺的看到網路流量的情況可以使用

  iftop - display bandwidth usage on an interface by host
會列出到每個host的網路的流出與流入。

如果想要看到更詳細的每個process的流量,可以使用 nethogs
       nethogs - Net top tool grouping bandwidth per process

nethogs 可以列出每個process流量消耗,

在redhat 系列安裝只要

yum install -y iftop
yum install -y nethogs





2014年9月9日 星期二

[武術][吳式太極拳]140904(四) 140906(六) 太極收式 弓腿




  • 一動必有一用
老師說到用法,說到吳大揆當時最強調的就是連收式都有用。
像老師請教了收式,老師說,扣緊他的脖子,想不到直接被抬了起來,這實在太妙了。

"再往下的鬆沈可能是你以前沒嘗試過的,可能有人還會害怕,所以要一點點的鬆沈一次比一次還進步"

本週見識了師兄跟老師的進步推手


老師有提到提手上勢,轉跨的靠的力量。都是很明細的。


2014年9月3日 星期三

[elasticsearch]get all facet term in elasticsearch / 得到所有的aggregation term list



elasticsearch 的 aggregation modules 是個方便取得 multi bucket 資料的模組。
可以動態的去統計每個欄位的獨立不重複的值的計數。

example

{
    "aggs" : {
        "genders" : {
            "terms" : { "field" : "gender" }
        }
    }
}
Response:
{
    ...

    "aggregations" : {
        "genders" : {
            "buckets" : [
                {
                    "key" : "male",
                    "doc_count" : 10
                },
                {
                    "key" : "female",
                    "doc_count" : 10
                },
            ]
        }
    }
}

特別來說在 term aggregation 內可以使用 size 這個 parameter 來要求返回 top N的值的統計訊息。( elasticsearch 中常常使用size這個parameter )

而如果你想要取得所以屬於該欄位的獨立值呢?

就可以把 size 使用 0 ,將被設定為 Integer.MAX_VALUE 。

{
    "aggs" : {
        "products" : {
            "terms" : {
                "field" : "product",
                "size" : 0
            }
        }
    }
}

另外可以使用的方法是 Cardinality Aggregation,
他會返回你所指定欄位有多少不重複的計數。

{
    "aggs" : {
        "author_count" : {
            "cardinality" : {
                "field" : "author"
            }
        }
    }
}
Cardinality Aggregation
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html




cf.
peicheng-note: elasticsearch 相關 elasticsearch文章
http://peichengnote.blogspot.tw/search/label/elasticsearch
peicheng note: [elasticsearch]safely reload configuration from elasticsearch.yml
peicheng note: [elasticsearch] url query_string length limit
peicheng note: [elasticsearch] 關於 brain split / cluster split 成兩個 clusters
peicheng note: [elasticsearch] 再談 _all field
http://peichengnote.blogspot.tw/2014/06/elasticsearch-all-field.html
peicheng note: [elasticsearch]range query depends on the field type
http://peichengnote.blogspot.tw/2014/06/elasticsearchrange-query-depends-on.htmlpeicheng-note: [elasticsearch] document id _id field uuid
http://peichengnote.blogspot.tw/2014/05/elasticsearch-document-id-id-field-uuid.html
peicheng-note: [elasticsearch/logstash] logstash id 自動產生 document id "_id" automatic id generation
http://peichengnote.blogspot.tw/2014/04/elasticsearchlogstash-logstash-id.html
peicheng note: [elasticsearch] index size , shard size , heap size design
http://peichengnote.blogspot.tw/2014/07/elasticsearch-index-size-shard-size.html
peicheng note: [Elasticsearch] NumberFormatException / Invalid shift value in prefixCoded bytes


2014年9月2日 星期二

[hadoop][best practices] how to choose the appropriate linux file system for HDFS 如何選擇一個合適的檔案系統




Hadoop Distributed File System(HDFS) 是一個獨立的平台,可以在運行在任何不同的文件系統與操作系統上運行。Linux 提供了多種的檔案系統的選擇,每個選擇對於HDFS性能有不同的影響。
一般來說的最佳實踐方案,在掛載(mount) Hadoop Data的硬碟建議不啟用 "noatime"。這將會加快文件讀取速度。
有三種比較流行的檔案系統
  • Ext3
  • Ext4
  • XFS
Yahoo 使用 ext3 檔案系統來做他們的hadoop 的預設 檔案系統。Ext3 也是許多作業系統預設的檔案系統。所以 HDFS on ex3 已經被Yahoo 廣泛的測試,這可能是個比較安全的檔案系統選項。

ext4 的前身是ext3 。ext4 對於大檔案有比較好的性能表現。ext4 還有 " delayed allocation of data ",可以會增加一點風險造成服務氣中段,但是同時減少碎片的產生與改進效能。

XFS 比起ext3 提供比較好的磁碟空間使用率而且有更快的格式化時間。這意味著你可以比較快的使用 XFS 的 datanode。

硬碟的I/O 是個主要影響 Hadoop 的性能問題。 ext3 已經被廣泛的使用在hadoop上,而 ext4 , xfs可以用來提供更加的性能。


Best Practices: Linux File Systems for HDFS - Hortonworks http://zh.hortonworks.com/kb/linux-file-systems-for-hdfs/

2014年9月1日 星期一

[武術]140830 (六) 140831(日) 吳式太極拳 白鶴亮翅 攬雀尾


秉持著好記性不如爛筆頭的精神,把所思所想學所聽給記錄下來。

本週六去了有點晚,已經打完了一趟拳架,聽老師說是在研究關於 "白鶴亮翅" 這個勢子。

白鶴亮翅 應該是分為兩個部分,從提手上勢接過來,開吸氣,左手下按,右手前按,俯跨轉腰,左手往後抬(微微轉手,兩手平面夾角約大於九十度),靠背起來,轉正,左手下,右手捋。

剛開始看老師跟師兄們在討論的關於,左手下右手捋的鬆沈應用。不過,在看吳家太極的演示比較多都是以摔來做演示,本來想說老師年紀高也不方便做這樣的演示。在老師說自己動動的時候,我請教了他,為什麼要右手前按,左手垂直按了。

他馬上叫我用兩隻手從後面扣住他的手,第一次,老師一鬆沈把我卸開了。可能第一次演示,老師也發現我沒有用力扣緊,他叫我在扣他一次,在我用力扣緊確定已經站穩的同時,老師一說 "鬆沈" 我整個人拔跟而起,往右前甩出,完完全全都在沒有知覺感應的狀態下,好像整個身體都負在老師身上一樣被甩出。這一記 白鶴亮翅 跟我在北京遇到 梁中成 老師(梁老師師承 戰升堂 宗師,戰老師為王茂齋關門弟子李文杰所傳唯一弟子 ),在 北大燕南園推手時變力被甩出去一樣,整個是個失重感。

後來老師跟師兄演示進步推手,老師說光是動步的推手,就有好幾種。從順步開始就是可以自由活動走步,再有坳步推手,轉身推手,最高就是跨步推手。

這裡觀察到,讓我一解長久的疑問,看到 吳鑑泉宗師的拳架,甚至是看到很多清末的高手的拳照,上身幾乎都是  /  然後下身有點 \ 呈現好像 ㄑ 字型一樣的狀態,我看到老師的身形也是如此。

老師提到,吳家太極明細,希望大家能夠多多的吸收。

  • 法才侶地
有方法去訓練
有才能
有同伴 他比你高 或是比你差一點的 或跟你差不多的 他第1手過來變了之後你又可以第2手第3手...etc
有練習的地方 可以跌撲
  • 吳式太極拳很明細的
精 了之後才會慢慢細
有些東西練了一次聽了一次可能還不太懂,動作都還做不標準,慢慢做作了三四次等到動作標準,再吸收用法用意。


週日,老師聊了一些在中國文革時期的故事,還有他關於解散軍隊結果軍隊被接收的看法。還有人民大公審,還有提到江青說他殺害6000萬人的故事。

鬆沈鬆靈

學習永無止境尋找更高的高手






2014年8月31日 星期日

[tech]"parse.com" api how to do "like" query or "contains" query / whitespace




You can get what you need with a a regex of the form "\^\QJ\E". The whole query will look like the following:
curl -H "X-Parse-Application-Id: $app_id" \
     -H "X-Parse-REST-API-Key:  $api_key" \
     -G --data-urlencode 'where={"first_name" : { "$regex" : "^\QJ\E" } }' \
     https://api.parse.com/1/users/

Are "like" or regex queries possible via the REST API? | Parse
https://www.parse.com/questions/are-like-or-regex-queries-possible-via-the-rest-api


2014年8月26日 星期二

[linux]shell script add zero padding



shell script中怎麼在數字前補上位數的零呢?

for i in $(seq -f "%05g" 10 15)
do
  echo $i
done
will produce the following output:
00010
00011
00012
00013
00014
00015

aa
More generally, bash has printf as a built-in so you can pad output with zeroes as follows:
$ i=99
$ printf "%05d\n" $i
00099
You can use the -v flag to store the output in another variable:
$ i=99
$ printf -v j "%05d" $i
$ echo $j
00099

numbers - Zero Padding In Bash - Stack Overflow
http://stackoverflow.com/questions/8789729/zero-padding-in-bash

[linux] ubuntu ssh slow appear



ubuntu ssh slow appear

在 ubuntu 上使用ssh 指令時,常常要等一陣子。
可以在 ssh時 使用-vvv option列出debug message。

debug2: bits set: 528/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/peicheng/.ssh/id_rsa (0x7f81c3da6ef0)
debug2: key: /home/peicheng/.ssh/id_dsa ((nil))
debug2: key: /home/peicheng/.ssh/id_ecdsa ((nil))
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/peicheng/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/peicheng/.ssh/id_dsa
debug3: no such identity: /home/peicheng/.ssh/id_dsa
debug1: Trying private key: /home/peicheng/.ssh/id_ecdsa
debug3: no such identity: /home/peicheng/.ssh/id_ecdsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password


可能原因有 GSSAPIAuthentication,GSSAPIAuthentication fail 問題,
可以在 sudo vim /etc/ssh/ssh_config or ~/.ssh/config
加上
GSSAPIAuthentication no                                                                                          
GSSAPIDelegateCredentials no




Why ssh “password” prompt takes too long to appear? - Ask Ubuntu
http://askubuntu.com/questions/246323/why-ssh-password-prompt-takes-too-long-to-appear

2014年8月18日 星期一

[elasticsearch] transport and http modules 的差別



elasticsearch java client 使用TCP/IP trasport
如果再不能撰寫java client 的情況下,可以使用http client ,透過 http 9200 port來做溝通。

[elasticsearch]safely reload configuration from elasticsearch.yml



在設定好 elasticsearch 的  elasticsearch.yml 後,如何安全的重新 reload 新的config呢?

目前唯一的reload config的方式就是 restart service。
所以,如果想達成沒有donwtime的cluster service,在restart前可以先使用 api check一下每個node service的status,在確保每個shard都已經存在另外的node上了,在逐步重開node。

http://esnode:9200/_cluster/health

cat health
http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-health.html


cf.
peicheng-note: elasticsearch 相關 elasticsearch文章
http://peichengnote.blogspot.tw/search/label/elasticsearch
peicheng note: [elasticsearch] url query_string length limit
peicheng note: [elasticsearch] 關於 brain split / cluster split 成兩個 clusters
peicheng note: [elasticsearch] 再談 _all field
http://peichengnote.blogspot.tw/2014/06/elasticsearch-all-field.html
peicheng note: [elasticsearch]range query depends on the field type
http://peichengnote.blogspot.tw/2014/06/elasticsearchrange-query-depends-on.htmlpeicheng-note: [elasticsearch] document id _id field uuid
http://peichengnote.blogspot.tw/2014/05/elasticsearch-document-id-id-field-uuid.html
peicheng-note: [elasticsearch/logstash] logstash id 自動產生 document id "_id" automatic id generation
http://peichengnote.blogspot.tw/2014/04/elasticsearchlogstash-logstash-id.html
peicheng note: [elasticsearch] index size , shard size , heap size design
http://peichengnote.blogspot.tw/2014/07/elasticsearch-index-size-shard-size.html
peicheng note: [Elasticsearch] NumberFormatException / Invalid shift value in prefixCoded bytes

2014年8月17日 星期日

[武術][吳式太極拳]140816 (六) 推手 與 雜記





  • 多看多聽多用心,見賢思齊,見不賢而內自省。看到好的可以學習,看到說為什麼哪裡打不好的可以檢討。
  • 簡化的太極?! 用法用意都要具備
  • 手不要擋住自己的視線,在用時才能夠習慣。像是打摟膝拗步時,手大概在鼻子高度。
  • 今天老師與師兄推手,觀察到,老師推手的方式跟鑑泉宗師的樣子類似。在跨摺疊 ㄑ字型,背部也是撐開的,重心沒有失過。
  • 進步栽捶  摟膝拗步變換動作時,如果有腳踢來,往下打在往前攻要害。往往拳架裡面有教很多種變化的用法像是 退步搬攔捶 上步搬攔捶,斜飛勢 橫斜飛勢都是同一個招式有不同的變化。
  • 一動必有一用 很明細的
  • 楊家快拳 是圓架
  • 吳公儀 在黃埔軍校,已經是教這個架子,大同小異。