Skip to content

Instantly share code, notes, and snippets.

# coding: utf-8
"""
ユースケース:
夫婦が離婚した場合、子の養育費は主に二人の収入によって決定する。
養育費を計算したいが、互いに自分の年収を相手に知らせたくない。
このとき、秘密計算によって互いの年収を知ることなく養育費を計算する。
"""
from flask import Flask, request, jsonify
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
@hassaku
hassaku / hopfield_network.py
Created December 26, 2016 18:17
Comparison results of monotone and nonmonotone output on Hopfield Network.
#!/usr/bin/env python
# encoding: utf-8
import numpy as np
from matplotlib import pyplot as plt
import matplotlib.cm as cm
class HopfieldNetwork(object):
def __init__(self, nonmonotone=False):
self.__nonmonotone = nonmonotone
@hassaku
hassaku / parse_enex.rb
Created December 22, 2016 21:27
enex形式でエクスポートされたEvernoteの名刺データをパースしてCSV化
#!/usr/bin/env ruby
# coding: utf-8
# USAGE: ruby parse_enex.rb XX.enex > XX.csv
require 'nokogiri'
require 'date'
require 'ostruct'
class Note < OpenStruct; end
@hassaku
hassaku / new_channel_notification.js
Last active April 25, 2016 14:09
Notify on Slack when new channel is created
/*
Libraries
- SlackApp: M3W5Ut3Q39AaIwLquryEPMwV62A3znfOO
- Underscore: MGwgKN2Th03tJ5OdmlzB8KPxhMjh3Sh48
- Moment: MHMchiX6c1bwSqGM1PZiW_PxhMjh3Sh48
Usage
- Create sheet named "Channel List", then paste this script on script editor.
*/
@hassaku
hassaku / extract_utterances.rb
Created April 1, 2016 15:31
Slackの特定ユーザのログ抽出
require 'json'
# 1. CSV export
# https://xxxxx.slack.com/services/export
# 2. Confirm target user ID
# curl https://slack.com/api/users.list?token=YOUR_SLACK_TOKEN
user = "XXXXXX"
export_dir = "export_csv/chanel_name"
@hassaku
hassaku / nnn.py
Created March 26, 2016 17:31
Memory and Learning of Sequential Patterns by Nonmonotone Neural Networks
#!/usr/bin/env python
# encoding: utf-8
import os
from logging import getLogger
import numpy as np
import copy
logger = getLogger(__name__)
@hassaku
hassaku / RubyConf2013プログラムのアブスト一部日本語訳
Last active December 24, 2015 03:39
興味のあるRubyConf2013プログラムのアブスト http://rubyconf.org/program
■ Promiscuous: A robust service-oriented architecture framework
Nicolas Viennot & Kareem Kouddous
小さなチームで、比較的巨大なアプリを数ヶ月で作成したことのある人達にとって、
乱雑なコードや遅いテスト、新規開発者の習得時間の長さなどのせいで、
RailsやSinatraを使ったときの幸福感といったものは、すぐに失われてしまうものだ。
サービスオブジェクトを抽出したり、MVCをMOVEなどにしたところで、コードが複雑になり、
シンプルにし損ねるだけだし、Javascript MVCは、多くのviewロジックを抽出するのに役立つものの、
巨大なバックエンドサーバはそのまま残ってしまうだろう。
そこで我々は、巨大なアプリを、メンテがしやすい、多くの小さなアプリに分割する方法を提案する。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JSONP TEST</title>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
</head>
<body>