This file contains 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
import passlib.totp | |
passlib.totp.TOTP('SECRETの値').generate().token |
This file contains 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
import boto3 | |
from base64 import b64encode, b64decode | |
AWS_KEY = 'ここにアクセスキーID' | |
AWS_SECRET = 'ここにシークレットアクセスキー' | |
AWS_LAMBDA_FUNCTION_NAME = 'ここにlambda関数名' | |
KMS_KEY_ID = 'arn:aws:kms:ap-northeast-1:XXXXXXXXXXXX:key/XXXX' | |
INPUT_VAL = 'hoge' |
This file contains 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
import boto3 | |
from base64 import b64encode, b64decode | |
AWS_KEY = 'ここにアクセスキーID' | |
AWS_SECRET = 'ここにシークレットアクセスキー' | |
AWS_LAMBDA_FUNCTION_NAME = 'ここにlambda関数名' | |
ENCRYPTED = 'lambda環境変数の暗号化済みの値' | |
kms = boto3.client( |
This file contains 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
import json | |
import boto3 | |
import os | |
from base64 import b64decode | |
def lambda_handler(event, context): | |
ENCRYPTED = os.environ['key1'] | |
DECRYPTED = boto3.client('kms').decrypt( | |
CiphertextBlob=b64decode(ENCRYPTED), |
This file contains 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
import os | |
import urllib.request, urllib.parse | |
MESSAGE = 'sample message.' | |
POST_SLACK_TOKEN_ID = os.environ.get('POST_SLACK_TOKEN_ID') | |
POST_SLACK_CHANNEL_ID = os.environ.get('POST_SLACK_CHANNEL_ID') | |
URL = 'https://slack.com/api/chat.postMessage' | |
headers = { | |
'Authorization': 'Bearer ' + POST_SLACK_TOKEN_ID |
This file contains 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
import cv2 | |
from tesserocr import PyTessBaseAPI, PSM | |
from PIL import Image | |
# 環境で変わると思うので変数として持つ | |
DEVICE_ID = 0 | |
# キャプチャの読み込み | |
cap = cv2.VideoCapture(DEVICE_ID) | |
# デフォルトの640x480だと文字認識で粗さがネックになるのでフルHDにしておく |
This file contains 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
import cv2 | |
import numpy as np | |
# 環境で変わると思うので変数として持つ | |
DEVICE_ID = 0 | |
# 高さ40幅120の切り取り画像の要素のうち一致している許容値 | |
THRESHOLD = 4600 | |
# 比較用画像を読み込み二値化しておく | |
hook_img = cv2.imread('hook.jpg', 0) |
This file contains 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
#!/bin/sh | |
if [ $# -ne 1 ]; then | |
echo "Params error." | |
exit 1 | |
fi | |
curl -F file=@$1 -F channels=$POST_SLACK_CHANNEL_ID -H "Authorization: Bearer $POST_SLACK_TOKEN_ID" https://slack.com/api/files.upload |
This file contains 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
import subprocess | |
import urllib.request, urllib.parse | |
DOMAIN = 'https://[スペースID].backlog.jp' | |
API_KEY = '[APIキー]' | |
TICKET_ID = '[チケットID]' | |
API_URL = DOMAIN + '/api/v2/issues/' + TICKET_ID + '/comments?apiKey=' + API_KEY | |
contents = { | |
'content' : subprocess.check_output("date").decode() |
This file contains 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
import subprocess | |
import urllib, urllib2 | |
DOMAIN = 'https://[スペースID].backlog.jp' | |
API_KEY = '[APIキー]' | |
TICKET_ID = '[チケットID]' | |
API_URL = DOMAIN + '/api/v2/issues/' + TICKET_ID + '/comments?apiKey=' + API_KEY | |
contents = { | |
'content' : subprocess.check_output("date") |
NewerOlder