Skip to content

Instantly share code, notes, and snippets.

View shimizukawa's full-sized avatar

Takayuki SHIMIZUKAWA shimizukawa

View GitHub Profile
@shimizukawa
shimizukawa / fio-wsl.ini
Last active June 5, 2018 15:20
Windows 10のWSLからファイルシステムの速度検証
# How to use:
# fio fio-wsl.ini
[seq-read]
rw=read
filename=/tmp/test2g
direct=1
bs=4k
size=2G
numjobs=64
@shimizukawa
shimizukawa / README.rst
Last active December 2, 2017 16:48
Sphinx拡張 文字数、翻訳率表示パネル pageinfo.py

Sphinx拡張 文字数表示パネル pageinfo.py に、翻訳率表示を加えた拡張です。

pageinfo.py と pageinfo.html を以下のように配置:

sphinx-project/
+- index.rst
+- conf.py
+- ext/pageinfo.py
+- _templates/pageinfo.html
@shimizukawa
shimizukawa / mp.py
Created November 28, 2017 08:50
asyncio concurrent multiprocess study
# -*- coding: utf-8 -*-
import concurrent.futures
import asyncio
import time
import sys
import signal
import functools
import logging
logging.basicConfig(format='%(asctime)s [%(process)d] %(name)s %(levelname)s: %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
@shimizukawa
shimizukawa / conf.py
Last active February 11, 2023 07:32
Sphinx column directive extension コラムディレクティブ拡張 for sphinx-1.6 or later LICENSE: CC BY https://creativecommons.org/licenses/by/3.0/deed
# -- directive/role definition ------------------------------------------------>
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
from docutils import nodes
class NamedNoteDirective(BaseAdmonition):
node_class = nodes.admonition
css_class = 'note'
#required_arguments = 1
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# I want display calculation tutorial with using PythonAnywhere. But I worry about that this code will confuse students.
# run this code on: https://www.pythonanywhere.com/gists/e870369b20c089981850e40e02713b8c/type-int.py/python3/
import time
import sys
ps1 = '>>> '
def emulate(text):
print(ps1, sep='', end='')
sys.stdout.flush()
time.sleep(2)
@shimizukawa
shimizukawa / sphinx_colorize_check.py
Last active January 24, 2017 07:12
checker for sphinx colorize console
# -*- coding: utf-8 -*-
#----- copy of sphinx/util/console.py -----
"""
sphinx.util.console
~~~~~~~~~~~~~~~~~~~
Format colored console output.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
@shimizukawa
shimizukawa / nose_with_repr_as.log
Last active January 5, 2017 15:05
nose output vs pytest output : with using test generator. repr_as is a kind of silencer wrapper
Checking dependencies...
Temporary files will be placed in /tmp/pytest.
Running Sphinx test suite (with Python 3.5.2)...
test_intl.test_image_glob_intl ... ok
test_intl.test_image_glob_intl_using_figure_language_filename ... ok
test_intl.test_additional_targets_should_be_translated(2, 2, ('CODE-BLOCKS', <literalblock.html contents>)) ... ok
test_intl.test_additional_targets_should_be_translated(1, 1, ('<span class="s1">&#39;RESULT&#39;</span>', <literalblock.html contents>)) ... ok
test_intl.test_additional_targets_should_be_translated(1, 1, ('<span class="c1">#include &lt;STDLIB.H&gt;</span>', <literalblock.html contents>)) ... ok
test_intl.test_additional_targets_should_be_translated(1, 1, ('<span class="cp">#include</span> <span class="cpf">&lt;STDIO.H&gt;</span>', <literalblock.html contents>)) ... ok
test_intl.test_additional_targets_should_be_translated(1, 1, ('<span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">sys</span> <span class="c1"># SYS IMPORTING</span>', <lite
@shimizukawa
shimizukawa / sample.py
Created November 27, 2016 04:40
warn when deprecated dict key is accessed
class Foo(object):
def __init__(self):
self.data = DelegateDict()
self.data.set_delegation('py:class', 'py:class_stack')