Skip to content

Instantly share code, notes, and snippets.

View hassaku63's full-sized avatar

Takuya Hashimoto hassaku63

View GitHub Profile
@hassaku63
hassaku63 / vimrc
Created November 2, 2021 19:08
minimum
syntax on
set ts=4
set sm
set number
inoremap <silent> jj <ESC>
@hassaku63
hassaku63 / main.go
Created October 24, 2021 08:32
sample http server using template
package main
import (
"log"
"net/http"
"sync"
"text/template"
"path/filepath"
)
@hassaku63
hassaku63 / serverless.yml
Last active October 4, 2021 07:27
serverless.yml example
# Welcome to Serverless!
#
# This file is the main config file for your service.
# It's very minimal at this point and uses default values.
# You can always add more config options for more control.
# We've included some commented out config examples here.
# Just uncomment any of them to get that config option.
#
# For full config options, check the docs:
# docs.serverless.com
@hassaku63
hassaku63 / logs.py
Created February 25, 2021 01:59
JSON Logger example
import os
import json
import logging
from unittest.mock import Mock
LOG_LEVEL = os.environ.get('LOG_LEVEL', 'DEBUG').upper()
if not (LOG_LEVEL in ('DEBUG', 'INFO', 'WARN', 'WARNING', 'ERROR', 'CRITICAL', 'FATAL')):
@hassaku63
hassaku63 / zsh_completion.md
Created January 25, 2021 17:11 — forked from rummelonp/zsh_completion.md
zsh の補完関数の自作導入編

zsh の補完関数の自作導入編

あまり深く理解してないので識者のツッコミ大歓迎

補完を有効にする

取り敢えず最低限だけ

# 補完を有効にする
@hassaku63
hassaku63 / make-pypkg-dir
Last active January 25, 2021 11:00
a shell function that is shortcut of making python-package directory
#
# CC0 license
#
function make-pypkg-dir () {
curdir=$(pwd);
created_dir=$(dirname $1)/$(basename $1);
mkdir $1 \
&& touch ${created_dir}/__init__.py \
&& echo "${created_dir}/__init__.py is created."
@hassaku63
hassaku63 / template.yml
Created December 29, 2020 18:02
AWS Cloud Map sample template
AWSTemplateFormatVersion: "2010-09-09"
Description: The AWS CloudFormation template for this Serverless application
Resources:
# Application resource
MyQueue:
Type: AWS::SQS::Queue
Properties:
Tags:
- Key: Name
@hassaku63
hassaku63 / determination-api-stack.ts
Created December 28, 2020 10:25
aws-cdk example - API Gateway V2 HTTP API & lambda NodejsFunction
import * as path from 'path';
import * as cdk from '@aws-cdk/core';
import * as ddb from '@aws-cdk/aws-dynamodb';
import * as apiGatewayV2 from '@aws-cdk/aws-apigatewayv2';
import { LambdaProxyIntegration } from '@aws-cdk/aws-apigatewayv2-integrations';
import { NodejsFunction, NodejsFunctionProps } from '@aws-cdk/aws-lambda-nodejs';
import { HttpIntegration, HttpIntegrationType } from '@aws-cdk/aws-apigatewayv2';
import { dirname } from 'path';
const project_root_dir = path.join(dirname(__filename), '../')
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from dotenv import load_dotenv
from pathlib import Path
from botocore.exceptions import ClientError
import boto3
import json
import functools
class Hook(object):
def init(self, event, context):
print(f'hook init: {event} {context}')
def before(self, event, context, record):
print(f'hook before: {event} {context} {record}')