Skip to content

Instantly share code, notes, and snippets.

@nnao45
nnao45 / disten.py
Last active April 27, 2022 14:37
Distribution Entropy (Peng Li, Chengyu Liu, Ke Li, Dingchang Zheng, Changchun Liu,Yinglong Hou. "Assessing the complexity of short-term heartbeat interval series by distribution entropy", Med Biol Eng Comput,2015, 53: 77-87.)
"""
Ref.
[1] Peng Li, Chengyu Liu, Ke Li, Dingchang Zheng, Changchun Liu,
Yinglong Hou. "Assessing the complexity of short-term heartbeat
interval series by distribution entropy", Med Biol Eng Comput,
2015, 53: 77-87.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(C) Peng Li 2013-2017
If you use the code, please make sure that you cite reference [1]
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@nnao45
nnao45 / index.vue
Last active May 30, 2020 16:05
test-accordion-04
<template>
<div class="app">
<div class="components">
<p class="title">アコーディオン1</p>
<transition
name="expand"
@enter="enter"
@after-enter="afterEnter"
@leave="leave"
@after-leave="afterLeave"
@nnao45
nnao45 / index.vue
Created May 30, 2020 13:09
test-accordion-01
<template>
<div class="app">
<div class="components">
<p class="title">アコーディオン1</p>
<transition
name="expand"
@before-enter="beforeEnter"
@enter="enter"
@before-leave="beforeLeave"
@leave="leave"
@nnao45
nnao45 / saga-exaple01.scala
Created January 9, 2020 05:13
this program is wrong?
package saga.sample01
import cats.effect.{Concurrent, ContextShift, IO}
import com.vladkopanev.cats.saga.Saga._
import scala.concurrent.ExecutionContext
object Main extends App {
implicit val ec: ContextShift[IO] = IO.contextShift(ExecutionContext.global)
@nnao45
nnao45 / main.scala
Last active January 8, 2020 12:06
Either vs Option
package state.sample01
case class V(value: Int)
object Main extends App {
val result1: Either[V, Unit] = Right(Unit)
val result2: Either[V, Unit] = Right(Unit)
val result3: Either[V, Unit] = Left(V(1))
val result4: Either[V, Unit] = Left(V(2))
@nnao45
nnao45 / validate_twitter_stream_message.rs
Last active June 4, 2019 09:21
validate_twitter_stream_message.rs
extern crate serde;
extern crate serde_json as sjson;
extern crate twitter_stream_message;
use twitter_stream_message::StreamMessage;
fn main() {
let data = r#"
{
"created_at": "Tue Jun 04 09:04:39 +0000 2019",
"id": 1135834739275735000,
# Setup Building Container
## Install Dependency Module
FROM rust:1.34.1-slim as builder
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu \
OPENSSL_INCLUDE_DIR=/usr/include/openssl \
RUST_VERSION=%%RUST-VERSION%%
RUN set -eux; \
fn main() {
let base_timeout = 30;
let mut counter = create_counter(base_timeout);
// twitter-stream-rsライブラリはsteram apiから4xxコードとかを受け取ると関数が返るのでloopで再生成してあげる必要がある。
loop {
// この.watch()が実質先ほどのサンプルコードのrt::run(bot)に当たる。
// twiqueryでは、連続失敗した時だけretryのインターバルを2倍にしていく。
match twitter_client::TwitterClient::new(&config).watch() {
twitter_client::RESET_FLAG => counter = create_counter(base_timeout),
twitter_client::UNRESET_FLAG => (),
fn main() {
const TRACK: &str = "@NAME_OF_YOUR_ACCOUNT";
// `credential.json` must have the following form:
// {"consumer_key": "...", "consumer_secret": "...", "access_key": "...", "access_secret": "..."}
let mut credential_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
credential_path.pop();
credential_path.push("credential.json");
@nnao45
nnao45 / gist
Last active September 26, 2018 07:02
golang interface
package main
import (
"fmt"
)
type Animal struct {
Cat string
Dog string
}