
python のランタイムでデバッグする場合、以下のような注意書きがあったり、Visual Studio Code でリモートデバッグするときは
ptvsd
を使う等いろいろあったのでメモ.
SAM ローカルを使用してサーバーレスアプリケーションをローカルでテストする - AWS Lambda
Python で記述された関数のデバッグ
Node.js や Java とは異なり、Python では Lambda 関数コードでリモートデバッグを有効にする必要があります。Python ランタイム (2.7 または 3.6) のいずれかを使用する関数に対して (上述の --debug-port オプションまたは -d オプションを使用して) デバッグを有効にすると、SAM Local はそのポートを通じてホストマシンから Lambda コンテナへのマッピングを行います。リモートデバッグを有効にするには、remote-pdb などの Python パッケージを使用します。
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
# Define ULID_DECODE and ULID_ENCODE which convert a ulid string to a binary and vice versa. | |
delimiter // | |
DROP FUNCTION IF EXISTS ULID_DECODE// | |
CREATE FUNCTION ULID_DECODE (s CHAR(26)) RETURNS BINARY(16) DETERMINISTIC | |
BEGIN | |
DECLARE s_base32 CHAR(26); | |
SET s_base32 = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(UPPER(s), 'J', 'I'), 'K', 'J'), 'M', 'K'), 'N', 'L'), 'P', 'M'), 'Q', 'N'), 'R', 'O'), 'S', 'P'), 'T', 'Q'), 'V', 'R'), 'W', 'S'), 'X', 'T'), 'Y', 'U'), 'Z', 'V'); | |
RETURN UNHEX(CONCAT(LPAD(CONV(SUBSTRING(s_base32, 1, 2), 32, 16), 2, '0'), LPAD(CONV(SUBSTRING(s_base32, 3, 12), 32, 16), 15, '0'), LPAD(CONV(SUBSTRING(s_base32, 15, 12), 32, 16), 15, '0'))); | |
END// |
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
var isWorkingDay = (year, month ,day, holidays) => ( | |
moment([year, month, day]).isValid() && | |
moment([year, month, day]).day() >= 1 && | |
moment([year, month, day]).day() <= 5 && | |
!holidays.includes(day) | |
) | |
var getWorkingDays = (targetYear, targetMonth, startDay, holidays) => { | |
let workingDays = [] | |
for(let i = startDay; i <= 31; i++) { |
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
module xxx | |
class Application < Rails::Application | |
#(中略) | |
config.middleware.swap ActiveRecord::ConnectionAdapters::ConnectionManagement, | |
'ActiveRecord::ConnectionAdapters::ReconnectOnErrorManagement' | |
end | |
end |
NewerOlder