This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![feature(test)] | |
| fn main() { | |
| println!("Hello, world!"); | |
| } | |
| fn from_f64_to_string(value: f64) -> String { | |
| value.to_string() | |
| } | |
| fn from_f64_to_string_by_ryu(value: f64) -> String { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from scipy.stats import norm | |
| from math import exp, log, sqrt | |
| def BS_Call(S0, sigma, r, q, T, K): | |
| d1 = (log(S0 / K) + (r - q) * T) / (sigma * sqrt(T)) + sigma * sqrt(T) / 2 | |
| d2 = (log(S0 / K) + (r - q) * T) / (sigma * sqrt(T)) - sigma * sqrt(T) / 2 | |
| call = S0 * exp(-q * T) * norm.cdf(x=d1, loc=0, scale=1) - K * exp(-r * T) * norm.cdf(x=d2, loc=0, scale=1) | |
| return call | |
| def BS_Put(S0, sigma, r, q, T, K): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use crate::minituna_v1::Objective; | |
| use crate::minituna_v1::Trial; | |
| use crate::minituna_v1::TrialError; | |
| struct Quadratic; | |
| impl Objective for Quadratic { | |
| fn objective(&self, trial: Trial) -> Result<f64, TrialError> { | |
| let x = trial.suggest_uniform("x", 0.0, 10.0); | |
| let y = trial.suggest_uniform("y", 0.0, 10.0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| foo(int*): # @foo(int*) | |
| push rbx | |
| mov rbx, rdi | |
| cmp dword ptr [rdi], 43 | |
| jl .LBB0_2 | |
| mov rdi, rbx | |
| call bar(int*) | |
| mov dword ptr [rbx], 42 | |
| .LBB0_2: | |
| mov rdi, rbx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package model | |
| case class DualNumbers(a: Double = 0d, b: Double = 0d) { | |
| def + : DualNumbers = this | |
| def - : DualNumbers = DualNumbers(-a, -b) | |
| def <(rhs: DualNumbers): DualNumbers = this < rhs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data Result v = Parsed v Derivs | |
| | NoParse | |
| data Derivs = Derivs { | |
| dvAdditive :: Result Int, | |
| dvMultitive :: Result Int, | |
| dvPrimary :: Result Int, | |
| dvDecimal :: Result Int, | |
| dvChar :: Result Char} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use crate::domain::repository::task::{MixInTaskRepository, TaskRepository}; | |
| use crate::infra::mysql::mysqlcon::{ | |
| MixInMySqlConnection, MySqlConnection, MySqlConnectionDependencies, | |
| }; | |
| use crate::infra::redis::pool_ctxt::{MixInRedisContext, RedisContext, RedisContextDependencies}; | |
| use crate::infra::repository::task::TaskRepositoryDependencies; | |
| use crate::{add_deps, add_mixin_impl}; | |
| pub struct TaskBootstrap {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use crate::domain::repository::task::{MixInTaskRepository, TaskRepository}; | |
| use crate::infra::mysql::mysqlcon::{MixInMySqlConnection, MySqlConnectionDependencies}; | |
| use crate::infra::redis::pool_ctxt::{MixInRedisContext, RedisContextDependencies}; | |
| use crate::infra::repository::task::TaskRepositoryDependencies; | |
| pub struct Bootstrap {} | |
| impl Bootstrap { | |
| pub fn call(&self) { | |
| let a = self.task_repository().find_task_by_id("aaa".to_string()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::io; | |
| #[derive(Debug, Clone, PartialEq, Eq, Hash)] | |
| struct Loc(usize, usize); | |
| impl Loc { | |
| fn merge(&self, other: &Loc) -> Loc { | |
| use std::cmp::{max, min}; | |
| Loc(min(self.0, other.0), max(self.1, other.1)) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.github.yytyd.status; | |
| public interface BuildStatus { | |
| } |
NewerOlder