Skip to content

Instantly share code, notes, and snippets.

@morlay
morlay / Migrate to Bun from NodeJS .md
Last active November 8, 2023 03:03
Migrate to Bun from NodeJS

Package Manager (from pnpm)

清空 node_modulespnpm-lock.yaml

find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;
rm pnpm-lock.yaml

bun install 即可

  • 跨平台 GUI 工具
  • 平台支持列表
    • Windows 7 +
    • Linux
      • Ubuntu 20+
    • macOS

路线选择

@morlay
morlay / AMapBaseLayer.tsx
Created November 1, 2021 05:49
AMapBaseLayer
import { must } from "@querycap/reactutils";
import * as AMap from "AMap";
import { Map } from "mapbox-gl";
import React, { createContext, ReactNode, useContext, useEffect, useState } from "react";
import { useMap, createCustomLayer } from "../mapbox";
import { AMapSDKLoader, useAMapSDK } from "./AMapSDK";
import { Styles } from "./Style";
const createFovHack = (m: Map) => {
const currentFov = 0;
@morlay
morlay / default.puml
Last active July 30, 2021 02:53
plantuml-skin
@startuml
!$turquoise = "#1ABC9C"
!$greensea = "#16A085"
!$emerald = "#2ECC71"
!$nephritis = "#27AE60"
!$peterriver = "#3498DB"
!$belizehole = "#2980B9"
!$amethyst = "#9B59B6"
!$wisteria = "#8E44AD"
@morlay
morlay / buildx_create_multi_arch_builder_in_k8s.md
Created July 21, 2021 06:06
Buildx create multi-arch builder in k8s

Buildx create multi-arch builder in k8s

With QEMU emulation

$ KUBECONFIG=${KUBECONFIG} \
    docker buildx create \
        --name=builder \
        --platform=linux/amd64,linux/arm64 \
        --driver=kubernetes \
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
name: installed-state
namespace: istio-system
spec:
hub: hub-dev.rockontrol.com/istio
tag: 1.6.5
addonComponents:
grafana:
@morlay
morlay / wsl.md
Last active April 14, 2021 03:08
# WSL 初探

WSL 1 的坑已经不修了,WSL 2 还是走向了虚拟化。 因此,WSL 是另一个系统,并且和纯 Linux 有所差异

文件

Windows in WSL

通过 /mnt/c/mnt/d 等路径,可以在 WSL 直接访问到 Windows 中的文件。 甚至是调用 Windows 的命令,添加 PATH 即可:

@morlay
morlay / MapWorld.ts
Created January 24, 2019 06:38
MapWorld.ts
import { mat4 } from "gl-matrix";
import { Map, Transform } from "mapbox-gl";
import {
Camera,
Group,
Light,
Matrix4,
Object3D,
Scene,
Vector3,
@morlay
morlay / Store.js
Created August 4, 2016 01:31
Simple Redux-like Store
class Store {
constructor(reducer, initialState) {
this.state = initialState;
this.reducer = reducer;
this.trigger = () => null;
}
subscribe(callback) {
this.trigger = callback;
}
@morlay
morlay / switch_captive_portal_server.sh
Created March 29, 2016 02:14
Switch Captive Portal Server in Mars
adb shell "settings put global captive_portal_server g.cn"