Skip to content

Instantly share code, notes, and snippets.

View Arathi's full-sized avatar

Arathi Arathi

View GitHub Profile
@Arathi
Arathi / Microhard.g4
Created August 7, 2025 06:05
MHRD的硬件设计语言
grammar Microhard;
design: input_section output_section part_section wire_section;
input_section: 'Inputs:' input (CM input)* SC;
output_section: 'Outputs:' output (CM output)* SC;
part_section: 'Parts:' part (CM part)* SC;
wire_section: 'Wires:' wire (CM wire)* SC;
input
@Arathi
Arathi / version.schema.json
Last active June 25, 2025 04:13
用来验证 Minecraft 的版本信息的 JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Version",
"description": "用来验证Minecraft的版本信息",
"type": "object",
"$defs": {
"argumentArray": {
"type": "array",
"items": {
"$ref": "#/$defs/argument"
@Arathi
Arathi / flex.tsx
Last active October 24, 2024 10:09
Flex,基于React的通用弹性布局函数式组件
import React from "react";
export type FlexContainerProperties = {
direction?: React.CSSProperties["flexDirection"];
wrap?: React.CSSProperties["flexWrap"];
justify?: React.CSSProperties["justifyContent"];
align?: React.CSSProperties["alignItems"];
gap?: React.CSSProperties["gap"];
};
@Arathi
Arathi / Grid.tsx
Created January 16, 2024 16:40
简单的React Native网格系统
import React, { ReactNode } from 'react';
import { View, StyleSheet, StyleProp, ViewStyle } from "react-native";
type ViewStyleProp = StyleProp<ViewStyle>;
type Props = {
width: number;
gutter?: number;
style?: ViewStyleProp;
children?: ReactNode;
@Arathi
Arathi / Version.ts
Created November 30, 2023 02:19
版本号
const regexVersion = /(\d+)\.(\d+)(\.(\d+))?(-([0-9A-Za-z]+))?(\+([0-9A-Za-z]+))?/;
class Version {
major: number = 0;
minor: number = 0;
patch?: number;
preRelease?: string;
build?: string;
constructor(
@Arathi
Arathi / ProgressBar.vue
Created November 23, 2023 06:30
Vue3进度条
<script setup lang="ts">
import { computed } from 'vue';
interface Props {
min?: number;
max?: number;
value?: number;
height?: number;
}
@Arathi
Arathi / hacknet.js
Last active November 27, 2023 09:49
Bitburner Scripts
/** @type {NS} */
var ns;
async function writeToFile(id, results) {
const path = `/responses/${id}.txt`;
const content = JSON.stringify(results);
ns.write(path, content);
}
async function list() {
@Arathi
Arathi / AHdl.g4
Created October 22, 2023 17:05
Arathi Hardware Description Language
grammar AHdl;
// 语法
module: inputs outputs parts wires EOF;
inputs: INPUTS input (CM input)* CM ES;
outputs: OUTPUTS output (CM output)* CM ES;
@Arathi
Arathi / Mhdl.g4
Last active October 19, 2023 04:20
MHRD的ANTLR语法
grammar Mhdl;
component: inputSection outputSection partSection wireSection EOF;
inputSection
: INPUTS input (CM input)* SC
;
outputSection
: OUTPUTS output (CM output)* SC
@Arathi
Arathi / JsonRpc.kt
Created August 1, 2023 02:27
JSON-RPC报文结构
import com.fasterxml.jackson.annotation.JsonInclude
open class Request<P>(
/**
* A String specifying the version of the JSON-RPC protocol.
* MUST be exactly "2.0".
*/
val jsonrpc: String = Version20,
/**