Skip to content

Instantly share code, notes, and snippets.

Avatar

Takuya Hashimoto hassaku63

View GitHub Profile
View vimrc
syntax on
set ts=4
set sm
set number
inoremap <silent> jj <ESC>
@hassaku63
hassaku63 / main.go
Created Oct 24, 2021
sample http server using template
View main.go
package main
import (
"log"
"net/http"
"sync"
"text/template"
"path/filepath"
)
@hassaku63
hassaku63 / serverless.yml
Last active Oct 4, 2021
serverless.yml example
View serverless.yml
# 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 Feb 25, 2021
JSON Logger example
View logs.py
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 Jan 25, 2021 — forked from mitukiii/zsh_completion.md
zsh の補完関数の自作導入編
View zsh_completion.md

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

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

補完を有効にする

取り敢えず最低限だけ

# 補完を有効にする
@hassaku63
hassaku63 / make-pypkg-dir
Last active Jan 25, 2021
a shell function that is shortcut of making python-package directory
View make-pypkg-dir
#
# 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 Dec 29, 2020
AWS Cloud Map sample template
View template.yml
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 Dec 28, 2020
aws-cdk example - API Gateway V2 HTTP API & lambda NodejsFunction
View determination-api-stack.ts
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), '../')
View settings.py
#!/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
View jeffy_hook_concept_impl.py
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}')