Skip to content

Instantly share code, notes, and snippets.

View KentaYamada's full-sized avatar
🏠
Working from home

yamaken KentaYamada

🏠
Working from home
View GitHub Profile
@KentaYamada
KentaYamada / question.py
Created June 21, 2022 09:16
初級問題
#
# [設問]ピッチャーのデータを分析するプログラムを作成してください
# 1. ピッチャーごとの平均球速を計算する関数を作成し、結果を表示してください
# 表示例) 田中将大の平均球速は154km/hです
# 補足: 小数点以下は「切り捨て」してください
# 2. ピッチャーごとの最高球速を計算する関数を作成し、結果を表示してください
# 表示例) 田中将大の最高球速は154km/hです
# 3. 最速のピッチャーは誰か計算する関数を作成し、結果を表示してください
# 表示例) 最速ピッチャーは田中将大、最高球速は156km/hです
#
@KentaYamada
KentaYamada / main.py
Last active May 16, 2020 08:54
Sample python watchdog
import time
import subprocess
from watchdog.events import PatternMatchingEventHandler
from watchdog.observers import Observer
class TestFileWatchEventHandler(PatternMatchingEventHandler):
def __run_test(self):
subprocess.call('python3 -m unittest discover ./tests', shell=True)
@KentaYamada
KentaYamada / main.py
Created May 4, 2020 08:25
Flask-JWT-Extended basic usage sample code
from flask import jsonify, request, Flask
from flask_jwt_extended import (
jwt_required,
create_access_token,
JWTManager
)
HTTP_OK = 200
HTTP_BAD_REQUEST = 400
HTTP_UNAUTHORIZED = 401
@KentaYamada
KentaYamada / object_to_json.py
Created December 5, 2019 03:55
Convert object to json string
import json
def json_dumps_handler(data):
has_dict = isinstance(data, object) and hasattr(data, '__dict__')
if not has_dict:
raise TypeError()
return data.__dict__
@KentaYamada
KentaYamada / rsync_quickrun.rc.vim
Last active May 17, 2019 04:35
vimproc quickrun rsync config
let g:quickrun_config = get(g:, 'quickrun_config', {})
let g:quickrun_config._ = {
\ 'runner': 'vimproc',
\ 'runner/vimproc/updatetime': 40,
\ 'outputter': 'error',
\ 'outputter/error/success': 'buffer',
\ 'outputter/error/error': 'quickfix',
\ 'hook/close_quickfix/enable_exit': 1
\ }
@KentaYamada
KentaYamada / server.py
Created May 11, 2019 14:02
Python3 flask JWT authorization example
from flask import jsonify, Flask
from flask_jwt import jwt_required, current_identity, JWT
class User:
def __init__(self, id, username, password):
self.id = id
self.username = username
self.password = password
@KentaYamada
KentaYamada / expected_response.json
Last active December 23, 2018 08:25
Verify has many association of data mapping patterns.
"car_makers": [
{
"id": 1,
"name": 'TOYOTA',
"cars": [
{
"id": 1,
"name": 'カローラ'
},
{
@KentaYamada
KentaYamada / logging.yaml
Created August 2, 2018 08:04
Output logging file sample
version: 1
formatters:
defaultFormatter:
format: '[%(asctime)s][%(levelname)s] %(message)s'
datefmt: '%Y-%m-%d %H:%M:%S'
handlers:
fileHandler:
formatter: defaultFormatter
@KentaYamada
KentaYamada / main.py
Created March 29, 2018 14:35
Using Psycopg2 callproc
# -*- coding: utf-8 -*-
import psycopg2
import psycopg2.extras
from psycopg2.extensions import adapt, register_adapter, AsIs
DB_CONFIG = {
'host': 'localhost',
'dbname': 'dbname',

ワークショップ@松谷邸

日時: 2018年2月4日(SUN) 12:00〜

検証したい事

  1. 開発者心理の変化
  2. 不具合検出率と不具合内容の変化が現れるのか

お題

【マイヤーズの三角形】
 1. ユーザーが3つの整数を入力する。この3つの整数は三角形の一辺の長さを表す