Skip to content

Instantly share code, notes, and snippets.

View calpa's full-sized avatar
💭
Nyahello

Calpa Liu calpa

💭
Nyahello
View GitHub Profile
@calpa
calpa / pyodide-numpy-monte-carlo-pi.py
Created August 8, 2025 09:19
Pyodide demo: interactive Monte Carlo π estimation with NumPy and Matplotlib (one-click run).
# Pyodide + NumPy 互動蒙特卡羅:一鍵估算 π 值與圖形化教學
import js, io, base64
import numpy as np
import matplotlib.pyplot as plt
# ---------- UI:頂端標籤 + 控制面板 ----------
tag = js.document.createElement("div")
tag.textContent = "Pyodide × NumPy Monte Carlo π"
tag.style.cssText = ("position:absolute;top:0;left:50%;transform:translateX(-50%);z-index:10000;"
"background:rgba(0,0,0,.7);color:#fff;padding:6px 10px;border-radius:0 0 8px 8px;")
@calpa
calpa / pyodide-matplotlib-modal.py
Created August 8, 2025 09:17
Pyodide demo: render Matplotlib chart in the browser with a fixed-top tag and centered modal overlay.
import matplotlib.pyplot as plt
import numpy as np
import io, base64, js
# 1) 產生圖表並轉成 data URL
x = np.linspace(0, 2*np.pi, 100)
y = np.sin(x)
plt.figure(figsize=(6, 4), dpi=120)
plt.plot(x, y, '--', linewidth=2)
plt.title('Sine in the Browser')
@calpa
calpa / upload-v2.vue
Last active October 8, 2023 10:20
IPFS Uploader
<template>
<div class="mb-4">
<el-input v-model="token" placeholder="API Token" type="password" />
<p class="text-sm">
If you don't have an API Token, you can get it from
<a
href="https://web3.storage/tokens/"
class="text-blue-400"
target="_blank"
@calpa
calpa / check.js
Last active June 3, 2023 05:56
Check Self Yuliverse Claim Transaction
import { axios } from "@pipedream/platform";
import moment from 'moment';
export default defineComponent({
props: {
address: {
type: "string",
label: "Address",
default: "",
},
@calpa
calpa / 📊 Weekly development breakdown
Last active December 21, 2022 04:44
📊 Weekly development breakdown
Still Gathering Statistics...

Keybase proof

I hereby claim:

  • I am calpa on github.
  • I am calpa (https://keybase.io/calpa) on keybase.
  • I have a public key ASDVNOag54DOnDa2zUhUWASmaRQs7LdJTrDPHasQzvv9ego

To claim this, I am signing this object:

{
"files": [
{
"dataset-name-en": "Current weather report",
"provider-id": "hk-hko",
"format": "rss",
"data_dictionary": "",
"dataset-id": "hk-hko-rss-current-weather-report",
"resource-name-tc": "本港地區天氣報告(簡體中文)",
"dataset-name-sc": "本港地区天气报告",