Skip to content

Instantly share code, notes, and snippets.

View hassaku63's full-sized avatar

Takuya Hashimoto hassaku63

View GitHub Profile
@hassaku63
hassaku63 / zendesk_search.py
Created September 4, 2019 02:48
件名でサーチして一覧をoutput.csvに出力
# coding: utf-8
import os
import csv
import argparse
from tqdm import tqdm
from zenpy import Zenpy
def main():
@hassaku63
hassaku63 / Makefile
Created September 12, 2019 14:40 — forked from irgeek/Makefile
Minimal test case to show aws-cli cloudformation package regression.
S3_BUCKET := cf-templates-1wwumiwcx5krz-ap-southeast-2
S3_PREFIX := 8b87ca7b-869e-4401-baa0-ad0522e32f21
AWSCLI := .venv/bin/aws
all: parent.pyaml
parent.pyaml: child.pyaml
child.pyaml: grandchild.pyaml
@hassaku63
hassaku63 / detect_dominant_language.py
Created December 28, 2019 11:28
lambdaの中でcomprehend apiを呼び出す
import json
import tempfile
import boto3
from uuid import uuid4
# Comprehend constant
REGION = 'us-west-2'
# Function for detecting the dominant language
@hassaku63
hassaku63 / detect_sentiment.py
Created December 28, 2019 11:29
lambdaの中でcomprehend apiを呼び出す
import json
import boto3
# Comprehend constant
REGION = 'us-west-2'
# Function for detecting sentiment
def detect_sentiment(text, language_code):
@hassaku63
hassaku63 / asl.json
Created December 28, 2019 11:44
s3にputしたオブジェクトを言語検出→感情分析して結果をSNS通知するワークフローを実装するStepFunctionsのASL定義
{
"Comment": "A Hello World example of the Amazon States Language using Pass states",
"StartAt": "DetectLanguageJob",
"States": {
"DetectLanguageJob": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "arn:aws:lambda:ap-northeast-1:012345678901:function:InvokeDetectLanguageFunctionName:$LATEST",
"Payload": {
# wrong answer...
import string
# 1千兆 + 1
N = int(input())
n_digits = len(str(1000000000000001))
letters = string.ascii_lowercase
x = N - 1
ans = []
provider:
name: aws
runtime: python3.8
profile: ${opt:profile, default}
stage: ${opt:stage, dev}
region: ${opt:region, us-east-1}
timeout: 30
environment:
# To tell lambda function to AWS AccountId by use pseudo-parameters plugin.
# AccountId is used to construct SQS Queue URL
"""
Declare all environment variables defined in .env.<stage-name> and serverless.yml as python variables.
If you would like to use environment variables in your code, you import this module then reference as constants of python variable.
By use this technique, you are able to use IDE auto-completion effectively when you writing python code.
It is useful to reduce miss-typing of environment variables.
"""
import os
import pathlib
import json
import dotenv
# WA
H, W, K = map(int, input().split())
C = []
for _ in range(H):
C.append(input())
from pprint import pprint
# pprint(C)
from pprint import pprint
# pprint(C)
import sys
from collections import Counter
from itertools import product, combinations
H, W, K = map(int, input().split())
C = []
for _ in range(H):