Convert unix time to datetime in redshift

select (timestamp ’epoch’ + unix_time_col * interval ‘1 second’)::datetime https://stackoverflow.com/questions/39815425/how-to-convert-epoch-to-datetime-redshift

October 16, 2018 · 1 min · birdchan

Daylight saving time

In the U.S., daylight saving time starts on the second Sunday in March and ends on the first Sunday in November, with the time changes taking place at 2:00 a.m. local time. https://en.wikipedia.org/wiki/Daylight_saving_time_in_the_United_States

October 16, 2018 · 1 min · birdchan

API Gateway and Lambda limits

For response body payload size limit, API Gateway is 10 MB, Lambda is 6MB. Ref: https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html https://docs.aws.amazon.com/lambda/latest/dg/limits.html

October 10, 2018 · 1 min · birdchan

Solving Sudoku with a single sql query?

Unbelievable… [code] WITH solve_sudoku(sud_str,ind) AS (SELECT sud, INSTR(sud, ’ ‘) FROM (SELECT ‘4 29 58 339 64 1 9 5 1 4 6 2 3 4 8 7 5 51 279 47 36 8’ sud FROM dual) UNION ALL SELECT SUBSTR(sud_str, 1, ind - 1) || z || SUBSTR(sud_str, ind + 1), INSTR(sud_str, ’ ‘, ind + 1) FROM solve_sudoku, (SELECT TO_CHAR(ROWNUM) z FROM dual CONNECT BY ROWNUM 0 AND NOT EXISTS (SELECT NULL FROM (SELECT ROWNUM lp FROM dual CONNECT BY ROWNUM <= 9) WHERE z = SUBSTR(sud_str, TRUNC((ind - 1) / 9) * 9 + lp, 1) OR z = SUBSTR(sud_str, MOD(ind - 1, 9) - 8 + lp * 9, 1) OR z = SUBSTR(sud_str, MOD(TRUNC((ind - 1) / 3), 3) * 3 + TRUNC((ind - 1) / 27) * 27 + lp + TRUNC((lp - 1) / 3) * 6, 1))) SELECT sud_str FROM solve_sudoku WHERE ind = 0; [/code] ...

October 8, 2018 · 1 min · birdchan

有空到五個地方走走

有空到五個地方走走,你會明白很多事情 1、書店:到裡面數一數自己沒讀過的書,你就會明白,自己知道的那點知識,只是皮毛。 2、奢侈品店:到裡面看看商品的標價,你會明白自己是個窮人,拼搏才是你的出路。 3、春耕的大地:頂著烈日,陪著農民朋友,從地的這邊走到那邊,走幾趟,你就會明白,自己的工作是多麼的優越。 4、醫院:這裡匯聚了人間痛苦,到裡面走走,你會明白健康有多麼的重要。 5、殯儀館:到了那裡你會明白,計較那麼多事有什麼用,活著比什麼都重要。

September 19, 2018 · 1 min · birdchan

Go vs Python by examples

http://govspy.peterbe.com/

September 18, 2018 · 1 min · birdchan

DRY is not always practical

This article says it well. I am glad I am not alone. https://programmingisterrible.com/post/176657481103/repeat-yourself-do-more-than-one-thing-and I have applied the DRY principle numerous times. Sometimes I found myself messing with the abstract class or common function again and again, introducing more and more switches to deal with various combinations of params. In those moments, I secretly hoped that there was no abstraction at all. May it be repeated code, coz at least when I tweak one thing I know that I am only tweaking one thing but not the rest of the dependent code. DRY is a good principle for sure, but I hope that we don’t just blindly follow it to write “good” code. ...

September 13, 2018 · 1 min · birdchan

Let's get honest about our money problems | Tammy Lally

https://www.ted.com/talks/tammy_lally_let_s_get_honest_about_our_money_problems

September 13, 2018 · 1 min · birdchan

Restaurant reviews in Seattle

An intern Kyle Wong from my work place wrote this. I think it’s interesting to read and get an idea about various restaurants in the Seattle area. He even took photos of his dishes. https://docs.google.com/document/d/1-9-vLD9rCqeHJ0HycX81PCWTFE–xra-09IZflGjB9w/edit

September 13, 2018 · 1 min · birdchan

山有山的高度,水有水的深度,沒必要攀比,每個人都有自己的長處。 風有風的自由,雲有雲的溫柔,沒必要模仿,每個人都有自己的個性。 你認為快樂的,就去尋找;你認為值得的,就去守候;你認為幸福的,就去珍惜。 世上沒有不被批評的事,也沒有不被猜測的人。 走自己的路。

August 24, 2018 · 1 min · birdchan