Skip to content

Instantly share code, notes, and snippets.

View singularitti's full-sized avatar
🎯
Focusing

Qi Zhang singularitti

🎯
Focusing
View GitHub Profile
@singularitti
singularitti / relink_prefix.sh
Created March 7, 2026 00:31
Rewrite symbolic link targets whose paths start with a specified prefix #Shell #file-system
@singularitti
singularitti / git_log_range.sh
Created March 3, 2026 02:36
Generate Git commit log within a range #Git #Shell #versioning #devops
git_log_range() {
"""
Print full multiline Git commit messages between two revisions.
Args:
$1 (string): Start revision (exclusive). Example: v1.2.0
$2 (string): End revision (inclusive). Example: HEAD
Defaults to HEAD if not provided.
Behavior:
@singularitti
singularitti / distributedjlpythoncall.sh
Last active February 21, 2026 05:30
Run PythonCall in Julia with multiple worker processes #Julia #Python #runtime-bridge
#!/usr/bin/env bash
set -euo pipefail
# Use single-threaded Julia per worker (PythonCall stability)
export JULIA_NUM_THREADS=1
# Force PythonCall to use your venv Python (e.g., 3.12)
export JULIA_PYTHONCALL_EXE="/path/to/bin/python"
# Launch Julia with 10 worker processes using current project
julia --project=. -p 10
@singularitti
singularitti / doc.md
Created February 10, 2026 18:05
`rsync_ext`: Sync Selected File Extensions Over SSH #SSH

Usage

Sync a single extension

rsync_ext user@remote /remote/base/dir/ /local/target/dir/ cif

Sync multiple extensions

@singularitti
singularitti / gen_sha256_claude_code.jl
Created February 7, 2026 21:44
Update Claude Code Homebrew cask #Julia #Homebrew #Shell
using Downloads
using Printf
const VERSION = "2.1.37"
const BASE = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases"
const TARGETS = [
("darwin", "arm64"),
("darwin", "x64"),
("linux", "x64"),
@singularitti
singularitti / list_valid_paths.jl
Created January 19, 2026 03:46
List strings to those that exist as valid filesystem paths #Julia #file-system
function list_valid_paths(paths)
valid = []
for p in paths
try
expanded = expanduser(p)
if ispath(expanded)
push!(valid, expanded)
end
catch
# Ignore malformed paths or permission issues
@singularitti
singularitti / one_hot_vector_heatmap.py
Last active December 15, 2025 12:49
Vector heatmaps #Python #plotting
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap, BoundaryNorm
from typing import Iterable, Tuple, Optional, Union
Color = Union[str, Tuple[float, float, float], Tuple[float, float, float, float]]
def vector_to_heatmap_array(vec: Iterable[int], vertical: bool = True) -> np.ndarray:
"""Converts a 1D binary vector into a 2D array for heatmap plotting.
@singularitti
singularitti / polymesh.py
Created December 15, 2025 06:28
Plot polygon meshes #Python #plot #mesh
import numpy as np
from scipy.spatial import Delaunay
import svgwrite
from pathlib import Path
# cairosvg might not be pre-imported after reset; import explicitly
import cairosvg
def polygon_mesh_svg(
@singularitti
singularitti / ut.json
Created December 14, 2025 07:53
UT Austin Primary Color Palette #JSON #color #design
{
"colors": [
{
"hex": "D6D2C4",
"name": "Westar",
"rgba": {
"alpha": 100,
"blue": 196,
"green": 210,
"red": 214
@singularitti
singularitti / cube_grid.jl
Last active November 19, 2025 10:23
Perspective rendering of M×N×P cube grids in Makie.jl #Julia #3D #visualization
using GLMakie
using GeometryBasics: Point3f, QuadFace, Mesh, Point3, Vec3
"""
axis_colored_cube_base(c_fb, c_tb, c_lr; size=1.0)
Build base geometry for a single cube whose three pairs of axis-aligned faces
share colors according to the Cartesian axes.
This is a low-level helper that constructs the vertex positions, face indices,