Skip to content

Instantly share code, notes, and snippets.

View yuntai's full-sized avatar
🏠
Working from home

yuntai yuntai

🏠
Working from home
View GitHub Profile
This file has been truncated, but you can view the full file.
1,-1,126.682,445.587,489.079,205.913,0.996153,-1,-1,-1
1,-1,1266.37,278.506,96.7231,78.263,0.977046,-1,-1,-1
1,-1,868.04,167.253,70.4472,47.9104,0.968232,-1,-1,-1
1,-1,1093.04,332.933,271.001,175.805,0.949291,-1,-1,-1
1,-1,1313.3,107.605,58.4822,22.9558,0.926559,-1,-1,-1
1,-1,1012.45,127.749,82.496,60.7935,0.907068,-1,-1,-1
1,-1,385.654,66.6637,28.8267,22.0213,0.872974,-1,-1,-1
1,-1,1126.07,173.51,93.9868,67.1671,0.826612,-1,-1,-1
1,-1,909.518,215.13,92.9806,92.0938,0.719844,-1,-1,-1
1,-1,1648.93,87.9435,87.5293,51.9693,0.703511,-1,-1,-1
@yuntai
yuntai / gist:9ddc6349df50fcb63c4f4a4dbf5f9484
Created September 13, 2018 16:49
rust-lightning htlc transcript
==============================================================
create chanel node1 <=> node2
==============================================================
node1.create_channel()
node1 !SendOpenChannel
node1 => node2 msgs::open_channel
node2 => node1 msgs::accept_channel
node1 !FundingGenerationReady
extern crate lightning;
extern crate secp256k1;
use secp256k1::key::PublicKey;
use secp256k1::{Secp256k1};
use lightning::ln::msgs;
use lightning::util::reset_rng_state;
use std::sync::atomic::{AtomicUsize,Ordering};
@yuntai
yuntai / schnorr.py
Last active April 4, 2018 05:15
schnorr, BN & mu signature with ProgrammingBlockchain codebase
import ecc
from ecc import PrivateKey
from random import randint
from helper import double_sha256, little_endian_to_int
# patch
ecc.FieldElement.__neg__ = lambda self: self.__class__(self.prime - self.num, self.prime)
ecc.Point.__sub__ = lambda self, other: self + (-other)
ecc.Point.__neg__ = lambda self: self.__class__(None, None, self.a, self.b) if self.x is None else self.__class__(self.x, -self.y, self.a, self.b)
0x1339c57B3186CFFBc669a646e52D005a7C66b5F2
import numpy as np
import sklearn.datasets
import sklearn.ensemble
import xgboost
N_TRAIN = 60000
NS_ITERATIONS = [2 ** k for k in range(8)]
MODELS = [
('RandomForestClassifier', sklearn.ensemble.RandomForestClassifier, {'n_jobs': -1}),
@yuntai
yuntai / SSHwithgit2go.go
Created September 6, 2016 04:31 — forked from zchee/SSHwithgit2go.go
Working example with SSH and libgit2/git2go
package main
import (
git "github.com/libgit2/git2go"
"log"
)
func credentialsCallback(url string, username string, allowedTypes git.CredType) (git.ErrorCode, *git.Cred) {
ret, cred := git.NewCredSshKey("git", "/home/vagrant/.ssh/id_rsa.pub", "/home/vagrant/.ssh/id_rsa", "")
return git.ErrorCode(ret), &cred
@yuntai
yuntai / min-char-rnn.py
Created November 19, 2015 06:48 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)