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
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
"github.com/aws/aws-sdk-go/aws" | |
"github.com/aws/aws-sdk-go/aws/session" | |
"github.com/aws/aws-sdk-go/service/dynamodb" |
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
'use strict'; | |
exports.handler = (event, context, callback) => { | |
const host = '<REPLARE_TO_YOUR_HOST>'; // e.g. https://michimani.net | |
// Extract the request from the CloudFront event that is sent to Lambda@Edge | |
var request = event.Records[0].cf.request; | |
// Extract the URI from the request | |
var requestUri = request.uri; |
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
""" Get weekly page view summary. """ | |
from apiclient.discovery import build | |
from oauth2client.service_account import ServiceAccountCredentials | |
import json | |
import re | |
SCOPES = ['https://www.googleapis.com/auth/analytics.readonly'] | |
KEY_FILE_LOCATION = 'client_secrets.json' |
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 glob | |
import os | |
import re | |
from typing import Final | |
HOME_DIR: Final[str] = "/Users/hoge" # change to your home directory | |
FILE_TYPE: Final[str] = "jpg" # or "png" | |
NEW_FILE_PATTERN: Final = r".*(\d{4})-(\d{2})-(\d{2})_\d{5,6}([^\/]+)?\." + FILE_TYPE | |
SC_DIR: Final = f"{HOME_DIR}/Pictures/__ss_tmp" | |
SC_OUT_DIR: Final = f"{HOME_DIR}/Pictures/000_ScreenShot" |
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
AWSTemplateFormatVersion: "2010-09-09" | |
Description: "Setup API Gateway custom domain name" | |
Parameters: | |
AcmArn: | |
Type: String | |
CustomDomainName: | |
Type: String | |
ApiID: | |
Type: String | |
DomainHostZoneId: |
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/bash | |
if [ $# != 2 ] || [ $1 = "" ] || [ $2 = "" ]; then | |
echo "Two parameters are required" | |
echo "" | |
echo "1st : string for API Key name (ex. user1)" | |
echo "2nd : string for Usage Plan ID (ex. abc123)" | |
echo "" | |
echo "example command" | |
echo "\t$ sh ./generate_api_key.sh user1 abc123" |
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
AWSTemplateFormatVersion: "2010-09-09" | |
Description: "API Gateway - usage plan template." | |
Parameters: | |
TargetApiId: | |
Type: String | |
Resources: | |
UsagePlan: | |
Type: "AWS::ApiGateway::UsagePlan" |
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
from time import sleep | |
from urllib.request import Request, urlopen | |
import argparse | |
import json | |
import traceback | |
GITHUB_REPOS_API = 'https://api.github.com/users/{user_name}/repos?per_page=100&page={page}' | |
PRINT_LINE = '{repo_name: <40}:{star_cnt: >6}' | |
p = argparse.ArgumentParser() |
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
from time import sleep | |
import boto3 | |
import json | |
import logging | |
import re | |
import traceback | |
import urllib.parse | |
import urllib.request | |
import xml.etree.ElementTree as ET |
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 traceback | |
from datetime import datetime, timezone, timedelta | |
from urllib.request import Request, urlopen | |
SLACK_WEBHOOK_URL = '<your-slack-incomming-webhook-url>' | |
SLACK_CHANNEL = '<your-slack-channel>' | |
TEST_EVENT_FILE = './sample__CodeBuild.json' | |