Skip to content

Instantly share code, notes, and snippets.

View hhatto's full-sized avatar
⛰️
enjoy

Hideo Hattori hhatto

⛰️
enjoy
View GitHub Profile
module gendoukage
go 1.16
require github.com/gorilla/mux v1.8.0 // indirect
@hhatto
hhatto / main.rs
Created November 17, 2019 15:01
rusoto sns example
use std::collections::HashMap;
use rusoto_core::credential::ProfileProvider;
use rusoto_core::request::HttpClient;
use rusoto_core::Region;
use rusoto_sns::{
Sns,
SnsClient,
CreatePlatformApplicationInput,
CreatePlatformEndpointInput,
from datetime import datetime
from benchmarker import Benchmarker
with Benchmarker(1000*500, width=40) as bench:
@bench("datetime->str(strftime)")
def _(bm):
d = datetime(2019, 1, 2)
for i in bm:
@hhatto
hhatto / xmlbench.py
Last active August 28, 2022 20:30
benchmark of Python's XML parsing packages
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"?>
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 September 6, 2018 12:50
count of aio package name on PyPI
#!/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 June 1, 2018 14:36
patch for Python 1.2 build on macOSX
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;
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)
0x00bc6b78D716e107a0C5D1b81FC64e50f5E045D3
@hhatto
hhatto / benchmarks.py
Last active March 14, 2018 09:03
benchmark of fpath module
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"