Skip to content

Instantly share code, notes, and snippets.

View y-yu's full-sized avatar

YOSHIMURA Yuu y-yu

View GitHub Profile
@y-yu
y-yu / json.cs
Created March 3, 2017 07:30
json
// Jsonシリアラザ・デシリアライザを示すインターフェース
public interface JsonWrite<T> {
string ToJsonString(T obj);
}
public interface JsonRead<T> {
T FromJsonString(string str);
}
// 具体的なシリアラザを呼び出す拡張メソッド
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This script is based on https://gist.githubusercontent.com/harding/d34b581d8cfbb8919812/raw/send-op-return.py
from sys import exit, argv
from os import system
from pycoin.services.blockchain_info import spendables_for_address
from pycoin.tx import script, Tx
from pycoin.tx.tx_utils import sign_tx
@y-yu
y-yu / grouping.py
Last active August 24, 2022 21:03
grouping
from charm.toolbox.ecgroup import ECGroup, G, ZR
from charm.toolbox.eccurve import prime192v1, prime192v2
from charm.core.math.integer import integer, toInt
import random
from functools import reduce
# utility functions
def random_point(group):
return group.random(G)
@y-yu
y-yu / pictures.tex
Created August 23, 2016 11:48
pictures
\RequirePackage{luatex85}
\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{cancel}
\begin{document}
%\begin{tikzpicture}
% \Tree[.$K$
% [.$K'_1$
@y-yu
y-yu / extensible_exception.swift
Last active May 27, 2016 05:18
Swift Segmentation Fault
protocol Transform1 {
associatedtype From
associatedtype To
static func apply(x: From) -> To
}
protocol Transform {
associatedtype From
associatedtype To
@y-yu
y-yu / sr.scala
Created January 26, 2016 17:10
shift/reset
case class ICont[+R, -O, +A](run: (A => O) => R) {
def runId[I >: A <: O]: R = run { (x: I) => x }
def map[B](f: A => B): ICont[R, O, B] = ICont { k => run(f andThen k) }
def flatMap[E, B](f: A => ICont[O, E, B]): ICont[R, E, B] = ICont { k => run { x => f(x).run(k) } }
}
object ICont {
def point[R, A](x: A): ICont[R, R, A] = ICont { k => k(x) }
@y-yu
y-yu / gach.puml
Created December 6, 2015 06:41
ガチャ2
@startuml
participant ユーザー as User
participant アプリケーション as App
participant サーバー as Server
participant データベース as DB
User -> App: ガチャを引くボタンを押す
App -> Server: ガチャを引くリクエストを送信
Server -> Server: $A$, $B$を生成
nil = \x x
cons = \x \y \f f x y
car = \x \y x
cdr = \x \y y
true = \x \y x
false = \x \y y
if = \b \t \e b t e
zero = \f \x x
$ rlwrap ./repl.moon
moon: ./parse.moon:8: (21) bad argument #1 to 'S' (string expected, got userdata)
stack traceback:
[C]: in function 'S'
./parse.moon:8: (21) in function 'CS'
./parse.moon:49: (79) in main chunk
[C]: in function 'require'
./repl.moon:3: (1) in main chunk
@y-yu
y-yu / keybase.md
Last active April 6, 2016 07:45
Keybase proof

Keybase proof

I hereby claim:

  • I am y-yu on github.
  • I am yyu (https://keybase.io/yyu) on keybase.
  • I have a public key whose fingerprint is F299 3A15 492A 691B C4EE 1919 3730 168B 63BE ABA3

To claim this, I am signing this object: