Created
February 8, 2014 05:00
-
-
Save daxanya2/8876919 to your computer and use it in GitHub Desktop.
Hipchatに入力した内容をAPIで取得してDay Oneにワンライナーで貼付ける ref: http://qiita.com/daxanya1/items/da15ce1853465e262ba8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://api.hipchat.com/v1/rooms/history?room_id={room_id}&date={date}&timezone=JST&format=json&auth_token={token} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"messages":[{"date":"2014-02-06T10:01:07+0900","from":{"name":"daxanya (-v-)","user_id":544xxx},"message":"https:\/\/github.com\/bowery\/orchestrate.js"},{"date":"2014-02-06T10:01:11+0900","from":{"name":"daxanya (-v-)","user_id":544xxx},"message":"orchestrate.js"},{"date":"2014-02-06T10:01:18+0900","from":{"name":"daxanya (-v-)","user_id":544xxx},"message":"http:\/\/www.slideshare.net\/who_you_me\/neo4j-24294061"},{"date":"2014-02-06T10:01:22+0900","from":{"name":"daxanya (-v-)","user_id":544xxx},"message":"\u30b0\u30e9\u30d5\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u300cNeo4j\u300d\u306e \u5c0e\u5165\u306e\u5c0e\u5165"}]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat example.json | jq '.messages[] | [.date, " ", .message] | add' | sed -e "s/^\"[0-9-]\{10\}T//" | sed -e "s/^\([0-9:]\{8\}\)+0900/\1/" | sed s/\"$// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10:01:07 https://github.com/bowery/orchestrate.js | |
10:01:11 orchestrate.js | |
10:01:18 http://www.slideshare.net/who_you_me/neo4j-24294061 | |
10:01:22 グラフデータベース「Neo4j」の 導入の導入 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat example.json | jq '.messages[] | [.date, " ", .message] | add' | sed -e "s/^\"[0-9-]\{10\}T//" | sed -e "s/^\([0-9:]\{8\}\)+0900/\1/" | sed s/\"$// | awk -v p=`date -v-1d +%Y-%m-%d` -F'\t' 'BEGIN{print "# hipchat-log",p} {print}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hipchat-log 2014-02-07 | |
10:01:07 https://github.com/bowery/orchestrate.js | |
10:01:11 orchestrate.js | |
10:01:18 http://www.slideshare.net/who_you_me/neo4j-24294061 | |
10:01:22 グラフデータベース「Neo4j」の 導入の導入 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -s -X GET 'https://api.hipchat.com/v1/rooms/history?room_id={room_id}&date='`date -v-1d +%Y-%m-%d`'&timezone=JST&format=json&auth_token={token}' | jq '.messages[] | [.date, " ", .message] | add' | sed -e "s/^\"[0-9-]\{10\}T//" | sed -e "s/^\([0-9:]\{8\}\)+0900/\1/" | sed s/\"$// | awk -v p=`date -v-1d +%Y-%m-%d` -F'\t' 'BEGIN{print "# hipchat-log",p} {print}' | dayone new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat example.json | jq '.messages[]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"message": "https://github.com/bowery/orchestrate.js", | |
"from": { | |
"user_id": 544xxx, | |
"name": "daxanya (-v-)" | |
}, | |
"date": "2014-02-06T10:01:07+0900" | |
} | |
{ | |
"message": "orchestrate.js", | |
"from": { | |
"user_id": 544xxx, | |
"name": "daxanya (-v-)" | |
}, | |
"date": "2014-02-06T10:01:11+0900" | |
} | |
{ | |
"message": "http://www.slideshare.net/who_you_me/neo4j-24294061", | |
"from": { | |
"user_id": 544xxx, | |
"name": "daxanya (-v-)" | |
}, | |
"date": "2014-02-06T10:01:18+0900" | |
} | |
{ | |
"message": "グラフデータベース「Neo4j」の 導入の導入", | |
"from": { | |
"user_id": 544xxx, | |
"name": "daxanya (-v-)" | |
}, | |
"date": "2014-02-06T10:01:22+0900" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat example.json | jq '.messages[] | [.date, .message]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
"2014-02-06T10:01:07+0900", | |
"https://github.com/bowery/orchestrate.js" | |
] | |
[ | |
"2014-02-06T10:01:11+0900", | |
"orchestrate.js" | |
] | |
[ | |
"2014-02-06T10:01:18+0900", | |
"http://www.slideshare.net/who_you_me/neo4j-24294061" | |
] | |
[ | |
"2014-02-06T10:01:22+0900", | |
"グラフデータベース「Neo4j」の 導入の導入" | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat example.json | jq '.messages[] | [.date, .message] | add' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"2014-02-06T10:01:07+0900https://github.com/bowery/orchestrate.js" | |
"2014-02-06T10:01:11+0900orchestrate.js" | |
"2014-02-06T10:01:18+0900http://www.slideshare.net/who_you_me/neo4j-24294061" | |
"2014-02-06T10:01:22+0900グラフデータベース「Neo4j」の 導入の導入" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat example.json | jq '.messages[] | [.date, ' ', .message] | add' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"2014-02-06T10:01:07+0900 https://github.com/bowery/orchestrate.js" | |
"2014-02-06T10:01:11+0900 orchestrate.js" | |
"2014-02-06T10:01:18+0900 http://www.slideshare.net/who_you_me/neo4j-24294061" | |
"2014-02-06T10:01:22+0900 グラフデータベース「Neo4j」の 導入の導入" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment