Skip to content

Instantly share code, notes, and snippets.

🚶
I may be slow to respond.

Hideo Hattori hhatto

Block or report user

Report or block hhatto

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hhatto
hhatto / xmlbench.py
Last active May 8, 2019
benchmark of Python's XML parsing packages
View xmlbench.py
from xml.etree import ElementTree
from lxml.etree import XML
import xmltodict
import untangle
from benchmarker import Benchmarker
N = 1000 * 1
N = 1000 * 100
xml_string = """<?xml version="1.0"?>
View autopep8.inplace.diff
diff --git a/DreamGame.py b/DreamGame.py
index bbe3119..9723b73 100644
--- a/DreamGame.py
+++ b/DreamGame.py
@@ -34,18 +34,24 @@ class DreamGame(SimGame):
vision_aggro_rule,
damage_provokes_rule]
- def __init__(self, bf=None, rules=None, is_sim = False, is_server=True, seed = None):
+ def __init__(
@hhatto
hhatto / getaioname-on-pypi.sh
Created Sep 6, 2018
count of aio package name on PyPI
View getaioname-on-pypi.sh
#!/bin/zsh
curl "https://pypi.org/simple/" > pypi.package.list.html
echo -n "XXXaio :"
grep "/simple/" pypi.package.list.html | grep "aio/" | grep -v "/aio-" | grep -v "\-aio/" | wc -l
echo -n "aioXXX :"
grep "/simple/" pypi.package.list.html | grep "/aio" | grep -v "/aio-" | grep -v "\-aio/" | wc -l
@hhatto
hhatto / patch.diff
Created Jun 1, 2018
patch for Python 1.2 build on macOSX
View patch.diff
diff --git a/Modules/rgbimgmodule.c b/Modules/rgbimgmodule.c
index 62e9e0b..331f9dc 100644
--- a/Modules/rgbimgmodule.c
+++ b/Modules/rgbimgmodule.c
@@ -499,7 +499,7 @@ int z;
while(1) {
pixel = *iptr++;
if ( !(count = (pixel & 0x7f)) )
- return;
+ return 0;
View patch.diff
diff --git a/extensions/zeromq/CMakeLists.txt b/extensions/zeromq/CMakeLists.txt
index fe03f29..ebca041 100644
--- a/extensions/zeromq/CMakeLists.txt
+++ b/extensions/zeromq/CMakeLists.txt
@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 3.2)
message("--- locating zeromq dependencies ---")
-find_package(ZeroMQ REQUIRED)
+#find_package(ZeroMQ REQUIRED)
@hhatto
hhatto / benchmarks.py
Last active Mar 14, 2018
benchmark of fpath module
View benchmarks.py
import sys
import os
import fpath
from benchmarker import Benchmarker
N = 1000 * 100
FILENAME = "file.txt"
B_FILE_PATH = b"/home/user/path/to/file.txt"
FILE_PATH = "/home/user/path/to/file.txt"
DIR_PATH = "/home/user/path/to"
View keybase.md

Keybase proof

I hereby claim:

  • I am hhatto on github.
  • I am hhatto (https://keybase.io/hhatto) on keybase.
  • I have a public key ASCn-lUbCdnX2NMnYkwGz3J1KaRT_SjRQsNM5ezAzMdDTwo

To claim this, I am signing this object:

@hhatto
hhatto / bench.py
Created Feb 2, 2018
python csv module benchmark
View bench.py
from benchmarker import Benchmarker
import unicodecsv
import csv
import fcsv
NUM = 500 * 1000
NUM = 10 * 1000
source = [["abc", "def", "ghi"],
["jkl", "あいう", "opq"],
["vvv", "v1", "v2"]]
@hhatto
hhatto / bench_csv.py
Last active Jan 28, 2018
benchmark script for python csv module
View bench_csv.py
# coding: utf-8
from benchmarker import Benchmarker
import unicodecsv
import csv
import fcsv
source = [["abc", "def", "ghi"],
["jkl", "あいう", "opq"],
["vvv", "v1", "v2"]]
source = (("abc", "def", "ghi"),
You can’t perform that action at this time.