Skip to content

Instantly share code, notes, and snippets.

View attakei's full-sized avatar

Kazuya Takei attakei

View GitHub Profile
@attakei
attakei / conf.py
Last active February 28, 2021 07:15
.readme.md
project = 'sphinx-revealjs-issue'
copyright = '2021, Kazuya Takei'
author = 'Kazuya Takei'
release = '2021.2.28'
extensions = [
'sphinx.ext.todo',
'sphinx_revealjs',
]
templates_path = ['_templates']
@attakei
attakei / case-1-no-config.md
Last active September 16, 2020 16:54
gunicorn edit header before passing wsgi

Run server

$ gunicorn main:app

Request/Response

No header

@attakei
attakei / readme.rst
Last active July 11, 2020 07:27
Using headless-chrome for MixBox

MixBoxをヘッドレスで呼ぶ

何をするもの?

7/10にバンダイナムコアーツがリリースした、サービスMixBoxをヘッドレスモードのGoogleChromeで呼びます。 再生開始まで行い、それ以上のことはしません。

MixBoxは こちら

FastAPI Middleware to forwarding hostname

Overview

FastAPI middleware to override Host header value by X-Forwarded-Host header value if it is exists.

FastAPI(Starlette) can make response used by X-Forwarded-Host header for slash-tailed redirection.

# Traial example for yandex-tank
## Usage
```bash
docker-compose run tank
```
@attakei
attakei / python_google_home_notify_ja.md
Last active November 23, 2020 13:56
Google home notifications by python

Pythonを使ってGoogle Homeに指定したテキストを喋らせる

使い方

  1. これをcloneする
  2. virtualenvを用意する
  3. pip install -r requirements.txtで依存パッケージをインストールする
  4. python server.pyでサーバーを起動する
  5. ブラウザで、サーバーにアクセスして、フォームにテキストと言語を指定して「喋る」ボタンを押す
  6. Google Homeが喋った!
@attakei
attakei / checkout_all_branches.py
Created December 30, 2017 01:17
Checkout all branches from 'origin'
#!/usr/bin/env python
"""Generated by act as 2017-12-30 09:57:20.386358
"""
import sys
import logging
from pathlib import Path
from git import Repo
Logger = logging.getLogger('checkout_all_branches')
@attakei
attakei / timer.plug
Last active September 6, 2017 10:19
Timer demo for errbot
[Core]
Name = Timer
Module = timer
[Documentation]
Description = Timer
import fire
class Calcurator(object):
def add(self, first, second):
return int(first) + int(second)
if __name__ == '__main__':
fire.Fire(Calcurator)
@attakei
attakei / kachidoki_elevator.cc
Created January 25, 2017 09:24 — forked from remore/kachidoki_elevator.cc
(1: 最適化問題) 下記パラメータのままでElevator::tick()のみを最適化して平均待ち人数を最小化する / (2: 並列化問題) 以下のプログラムをマルチスレッドで動作させると何倍早くなるか実装して検証する / (3: チューニング問題)並列化以外の方法で本プログラムの実行時間を短縮するためにどのような改修を加えるとよいか考察する
#include <iostream>
#include <iomanip>
#include <random>
#include <unistd.h>
using namespace std;
const int MAX_FLOOR = 14;
const int ELEVATOR_COUNT = 4;
const int RAISING_PROBABILITY = 10;