Skip to content

Instantly share code, notes, and snippets.

:octocat:

Hideaki Suzuki h2suzuki

:octocat:
  • FutureStandard
  • Mitaka, Tokyo
Block or report user

Report or block h2suzuki

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
View fsblog-20170302-transform_images.py
from __future__ import print_function
import numpy as np
import argparse
from PIL import Image, ImageFilter
import time
import chainer
from chainer import cuda, Variable, serializers
from net import *
View fsblog-20170302-mirror_images.py
import numpy as np
import zmq
import zmq_utils
# Setup ZeroMQ image publisher & receiver
context = zmq.Context()
sub = context.socket(zmq.SUB)
sub.setsockopt_string(zmq.SUBSCRIBE, "image")
sub.set_hwm(1)
View fsblog-20170302-zmq_utils.py
import numpy as np
import json
import zmq
def send_image(socket, image, channel = b"image"):
# Serialize a Numpy array
dtype = str(image.dtype).encode('ascii')
shape = json.dumps(image.shape).encode('ascii')
data = image.tostring('C')
View fsblog-20170302-pub_images.py
import numpy as np
import time
import scorer
import zmq
import zmq_utils
# Setup ZeroMQ image publisher & receiver
context = zmq.Context()
View fsblog-20170219-rep_client.py
import zmq
import numpy as np
import json
import time
# ZeroMQ のバックグラウンド・スレッドのコンテキスト
context = zmq.Context()
# このクライアントは、ポート5556に接続します(バックグラウンドにて)
socket = context.socket(zmq.REP)
View fsblog-20170219-req_server.py
import zmq
import numpy as np
import json
# ZeroMQ のバックグラウンド・スレッドのコンテキスト
context = zmq.Context()
# このサーバは、ポート5556で待ちます
socket = context.socket(zmq.REQ)
socket.bind("tcp://*:5556")
View fsblog-20170217-sub_server.py
import sys
import zmq
if (len(sys.argv) != 2):
print("Usage: # python3 {} <channel>".format(sys.argv[0]))
sys.exit(1)
ch = sys.argv[1]
View fsblog-20170217-pub_client.py
import sys
import zmq
import time
if (len(sys.argv) != 2):
print("Usage: # python3 {} {{alphabet|number}}".format(sys.argv[0]))
sys.exit(1)
mode = sys.argv[1]
View fsblog-20170216-sub_client.py
import sys
import zmq
if (len(sys.argv) != 2):
print("Usage: # python3 {} <channel>".format(sys.argv[0]))
sys.exit(1)
ch = sys.argv[1]
View fsblog-20170216-pub_server.py
import zmq
import time
# ZeroMQ のバックグラウンド・スレッドのコンテキスト
context = zmq.Context()
# このサーバは、ポート5556で待ちます
socket = context.socket(zmq.PUB)
socket.bind("tcp://*:5556")
You can’t perform that action at this time.