Skip to content

Instantly share code, notes, and snippets.

A.Hisame a-hisame

Block or report user

Report or block a-hisame

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
@a-hisame
a-hisame / gzip_s3_and_json_py3.py
Created Jul 3, 2018
To use gzip file between python application and S3 directly for Python3
View gzip_s3_and_json_py3.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''To use gzip file between python application and S3 directly for Python3.
Python 2 version - https://gist.github.com/a-hisame/f90815f4fae695ad3f16cb48a81ec06e
'''
import io
import gzip
import json
@a-hisame
a-hisame / pytzjst.py
Created Aug 25, 2017
pytzの仕様厳格化によって時刻情報なしだとAsia/TokyoがLMT+9:19:00になる場合の対処とか
View pytzjst.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
日本語の記事とかだと - http://qiita.com/higitune/items/0ca244373d380cf1c060
'''
import datetime
import pytz
@a-hisame
a-hisame / response_util.py
Created Dec 7, 2016
Example: Utility Responses on Python bottle
View response_util.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import datetime
import zipfile
import io
from bottle import HTTPResponse
@a-hisame
a-hisame / timeout.py
Last active Sep 12, 2016
タイムアウト付き標準入力モジュール
View timeout.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
stdin reader with timeout implementation
タイムアウト付き標準入力モジュール
c.f. http://qiita.com/siroken3/items/4bb937fcfd4c2489d10a
'''
import sys
@a-hisame
a-hisame / gzip_s3_and_json.py
Created May 17, 2016
Amazon S3と永続化ファイルを経由せずにjson.gzを取り扱う (boto3を利用)
View gzip_s3_and_json.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import gzip
import StringIO
import boto3
def upload(bucket, key, obj):
s3 = boto3.client('s3')
@a-hisame
a-hisame / DispatchTest.scala
Created Jan 8, 2015
実行するとMainスレッドが落ちても裏でスレッドが動作しててアプリケーションが終了しない。
View DispatchTest.scala
import dispatch.url
import dispatch.Http
import dispatch.as
import dispatch.Defaults._
object Main {
def main(args: Array[String]): Unit = {
import dispatch._, Defaults._
val svc = url("http://www.google.co.jp/")
@a-hisame
a-hisame / finish_notify.py
Created Dec 16, 2014
DynamoDBのテーブルに処理結果が格納されたかをチェックするプログラム
View finish_notify.py
#!/usr/bin/env python
# coding: utf-8
# -----------------------
# 設定によって変更するところ
# -----------------------
REGION = 'ap-northeast-1'
AWS_ACCESS_KEY = ''
AWS_SECRET_ACCESS_KEY = ''
@a-hisame
a-hisame / receiver.py
Created Dec 16, 2014
QueueからデータをPollingして、処理をし、処理結果をDynamoDBに保存するサンプル
View receiver.py
#!/usr/bin/env python
# coding: utf-8
import time
import datetime
import json
import logging
import boto.sqs
@a-hisame
a-hisame / sender.py
Created Dec 16, 2014
SNSへの通知を行うプログラム
View sender.py
#!/usr/bin/env python
# coding: utf-8
import uuid
import datetime
import boto.sns
# -----------------------
# 設定によって変更するところ
@a-hisame
a-hisame / restore.py
Created Dec 4, 2014
dump.py で取得したdumpファイルからDynamoDBを復元するプログラム
View restore.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Restore DynamoDB Tables from Dump File.
This program does not cover all DynamoDB format,
but It's good enough for me.
dump.py can dump Tables to JSON file.
You can’t perform that action at this time.