Skip to content

Instantly share code, notes, and snippets.

View jwt625's full-sized avatar
🐢
Alive

Wentao jwt625

🐢
Alive
View GitHub Profile
@jwt625
jwt625 / visual_density_point_grid_20240905.py
Created September 5, 2024 14:06
Visual density of points from a 2D grid. Brute force.
import numpy as np
import matplotlib.pyplot as plt
# Parameters
n_grid = 500
# Create the meshgrid
xs, ys = np.meshgrid(np.arange(1, n_grid+1), np.arange(1, n_grid+1))
# Reshape the grids

I will give you a long post and ask you to exract tags from it. I will also give you list of example tags from past posts. Here are some example tags:

  • PCSEL
  • Nanotube
  • Lens
  • Optics
  • Flexure
  • RSA
  • Microwave

You are an expert Python developer who specializes in writing matplotlib code based on a given picture. I found a very nice picture in a STEM paper, but there is no corresponding source code available. I need your help to generate the Python code that can reproduce the picture based on the picture I provide. Note that it is necessary to use proper figsize to set the image size to match the original size. Now, please give me the matplotlib code that reproduces the picture below.

fn magic_energy<D: Dim>(q: D) -> Energy =
if is_zero(q)
then 0
else if is_dimensionless(q / s) # q is a time: E = h / q
then ℎ / quantity_cast(q, s)
else if is_dimensionless(q * s) # q is a frequency: E = h *q
then ℎ * quantity_cast(q, 1/s)
else if is_dimensionless(q / K) # q is a temperature: E = k_B T
then k_B quantity_cast(q, K)
else if is_dimensionless(q / m) # q is a wavelength: E = ℎ c / λ
@jwt625
jwt625 / speed-up.js
Created April 22, 2025 01:32
Tampermonkey script for speeding up web media
// ==UserScript==
// @name force‑1.25×‑every‑media
// @match *://*/*
// @run-at document-start
// ==/UserScript==
(() => {
const RATE = 1.5;
/* ---------- HTMLMediaElement ---------- */
const desc = Object.getOwnPropertyDescriptor(
@jwt625
jwt625 / dark_mode.js
Created May 26, 2025 06:57
Chrome global dark mode
// ==UserScript==
// @name Smart Global Dark Mode
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Apply dark mode on all sites except blacklisted ones
// @author You
// @match *://*/*
// @grant GM_addStyle
// ==/UserScript==
"""
Minimal orchestrator implementation demonstrating two-phase execution pattern.
Uses the same LLM for both planning and execution phases.
"""
import json
import re
import datetime
import os
import time