Skip to content

Instantly share code, notes, and snippets.

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

Gabriel Liu flying3615

🏠
Working from home
View GitHub Profile
@flying3615
flying3615 / decision-tree.tsx
Created November 12, 2025 22:36
price action decision tree
// 建仓决策树页面 v1.0
// 基于交易形态指南的完整决策树系统
// 使用 React Flow 实现决策树可视化
'use client';
import { useCallback } from 'react';
import {
ReactFlow,
Node,
@flying3615
flying3615 / index.ts
Created March 5, 2025 22:39
MCP tutorial
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import axios from "axios";
import dotenv from "dotenv";
import {ForecastDay, isValidForecastArgs, OpenWeatherResponse, WeatherData} from "./types/weather.js";
import {
CallToolRequestSchema,
ErrorCode,
ListResourcesRequestSchema, ListToolsRequestSchema,
McpError,
@flying3615
flying3615 / volatility.js
Last active November 12, 2025 22:43
yahoo finance2 calculate Volatility
import yahooFinance from 'yahoo-finance2';
async function analyzeStock(symbol, period) {
try {
const today = new Date();
const startDate = new Date();
startDate.setMonth(today.getMonth() - period);
const queryOptions = {
period1: startDate.toISOString(), // 使用 toISOString() 获取正确的日期字符串
import React from 'react'
import PropTypes from 'prop-types'
import { graphql } from 'gatsby'
import styled from '@emotion/styled'
import { Layout, Listing, Wrapper, Title, SEO, Header } from '../components'
import website from '../../config/website'
const Hero = styled.header`
padding-top: 1rem;
padding-bottom: 4rem;
@flying3615
flying3615 / TestOptional.java
Created May 21, 2019 22:01
UT for Some&None
public class OptionTest {
private List<Option<String>> names = null;
@Before
public void setup() {
names = new ArrayList<Option<String>>();
names.add(new Some<String>("Dean"));
names.add(new None<String>());
names.add(new Some<String>("Wampler"));
}
@Test
@flying3615
flying3615 / None.java
Created May 21, 2019 21:49
Null for Optional
public final class None<T> extends Option<T> {
public static class NoneHasNoValue extends RuntimeException {}
public None() {}
public boolean hasValue() { return false; }
public T get() { throw new NoneHasNoValue(); }
@flying3615
flying3615 / Some.java
Last active May 21, 2019 21:47
Some of something
public final class Some<T> extends Option<T> {
private final T value;
public Some(T value) { this.value = value; }
public boolean hasValue() { return true; }
public T get() { return value; }
@flying3615
flying3615 / ListModule.java
Created May 21, 2019 03:42
Create again, for the FP version of List for java
public class ListModule {
public static interface List<T> {
public abstract T head();
public abstract List<T> tail();
public abstract boolean isEmpty();
public List<T> filter(Function1<T, Boolean> f);
@flying3615
flying3615 / Example.java
Created May 12, 2019 22:45
Dirty check when inserting POJO into DB
//Anotation for fields need to check
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ModifiableField {
}
public abstract class PersistedObject {
public static final long UNSET_PRIMARY_KEY = 0L;
@flying3615
flying3615 / cloudSettings
Last active September 22, 2019 21:03
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-09-22T20:45:43.031Z","extensionVersion":"v3.2.9"}