Skip to content

Instantly share code, notes, and snippets.

View aodag's full-sized avatar

Atsushi Odagiri aodag

View GitHub Profile
Dear Odagiri san,
My name is Arshad. IT Recruiter with ACS Japan.
How is your current work Situation.
Are you open to hear about new Job Opportunities?
If you are open, can I know when you are available for 5 minutes to talk or you can call me on 03-6868-7512.
import json
import itertools
with open("Pipfile.lock") as f:
lock = json.load(f)
print("\n".join(g for g, l in itertools.groupby(sorted(["{k}{v[version]}".format(k=k, v=v) for k, v in (list(lock["default"].items()) + list(lock["develop"].items()))]))))
import math
from pyramid.config import Configurator
from pyramid.renderers import JSON
def nan(request):
return {"n": math.nan}
def inf(request):
return {"i": math.inf}
import time
import types
def sleep(delay):
begin = time.time()
while time.time() < begin + delay:
yield
return time.time()
import time
def sleep(delay):
begin = time.time()
while time.time() < begin + delay:
yield
return time.time()
>>> def gen1():
...     yield 1
...     yield 2
...     yield 3
...
>>> g1 = gen1()
>>> next(g1)
1
>>> next(g1)
2
@aodag
aodag / person.py
Created July 21, 2018 12:12
typing, attrs and sqlalchemy
from typing import Optional
import attr
from sqlalchemy import (
Table,
MetaData,
Column,
Unicode,
Integer,
create_engine,
ForeignKey,
@aodag
aodag / hello.py
Last active July 21, 2018 09:06
pyramid with mypy
from pyramid.config import Configurator
from pyramid.interfaces import IRequest, IResponse
from abc import ABC
class IHelloContext(ABC):
""" resource of hello """
message: str
"""
>>> v = {"a": 1, "b": 2}
>>> assert v == {"a": 1, "b": Any()}
>>> assert v == {"a": 1, "b": IsA(int)}
"""
class Any:
def __eq__(self, o):