Skip to content

Instantly share code, notes, and snippets.

@fhk
fhk / ClaudeDesignBaseApp.jsx
Created April 30, 2026 03:31
Claude Design Base
// DesignCanvas.jsx — Figma-ish design canvas wrapper
// Warm gray grid bg + Sections + Artboards + PostIt notes.
// Artboards are reorderable (grip-drag), labels/titles are inline-editable,
// and any artboard can be opened in a fullscreen focus overlay (←/→/Esc).
// State persists to a .design-canvas.state.json sidecar via the host
// bridge. No assets, no deps.
//
// Usage:
// <DesignCanvas>
@fhk
fhk / calc.html
Created November 21, 2025 17:22
broadband calculator
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fiber Construction Cost Calculator</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
@fhk
fhk / gemini_geograph.py
Created August 20, 2024 01:03
gemini_geograph.py
import momepy
import geopandas as gpd
def create_graph(linestrings):
gdf = gpd.GeoDataFrame(geometry=linestrings)
graph = momepy.gdf_to_nx(gdf, approach="primal")
return graph
from shapely.geometry import LineString, Point
from shapely.ops import unary_union
from geopy.distance import geodesic
def snap_to_nearest_node(point, nodes, tolerance):
for node in nodes:
if geodesic((point.y, point.x), (node.y, node.x)).meters <= tolerance:
return node
return point
@fhk
fhk / Broadband.md
Created May 23, 2024 17:16
Broadband Plan

First Steps for a Citywide Fiber Network

Here's a breakdown of the initial steps you'd take to initiate a citywide fiber project, incorporating elements from the provided feasibility studies and focusing on funding, ISP evaluation, and infrastructure considerations:

Phase 1: Strategy & Policy Development

  1. Establish a Broadband Policy: Define the city's vision for broadband. This should cover:
  • Goals: Ubiquity, affordability, competition, open access, desired speeds, and financial sustainability.
  • Roles: The city's role as owner, facilitator, or partner.
  • Community Engagement: Processes for gathering public input and ongoing communication.
# Some quick snippets for points to lines
address_df = pd.DataFrame([[0, Point([c for c in h3.cell_to_latlng(h3_8)[::-1]])]], columns=['id', 'geometry'])
address_gdf = gpd.GeoDataFrame(address_df, geometry="geometry", crs="epsg:4326")
gdf = gpd.read_file(
"./data/all_the_data.fgb",
engine="pyogrio", bbox=location_box)
gdf = gdf.to_crs('epsg:3310') # https://epsg.io/3310
@fhk
fhk / trello_2csv.py
Created March 8, 2023 19:16
Yay JSON export isn't premium but csv is. Lets just move some data...
import sys
import json
import csv
def main():
input_json = sys.argv[1]
output_csv_data = [['name', 'lastdate', 'desc', 'shorturl']]
with open(input_json, mode='r') as ijson:
data = json.load(ijson)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fhk
fhk / IncreasingCostMST_Generator.py
Created April 22, 2022 16:57 — forked from niroyb/IncreasingCostMST_Generator.py
Searches a graph and yields all the minimum spanning trees in order of increasing cost. This could be used to solve minimum spanning trees with constraints by yielding trees until we reach the first one which satisfies a constraint. For example it could solve the degree constrained minimum spanning tree DCMST
#!/Usr/bin/env python
# -*- coding: utf-8 -*-
'''
Searches a graph and yields all the minimum spanning trees in order of increasing cost.
This could be used to solve minimum spanning trees with constraints by yielding trees until
we reach the first one which satisfies a constraint.
For example it could solve the degree constrained minimum spanning tree DCMST
'''
wget https://golang.org/dl/go1.16.7.linux-amd64.tar.gz;
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.16.7.linux-amd64.tar.gz;
export PATH=$PATH:/usr/local/go/bin;
export GOPATH=$HOME/go;
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin;
go get github.com/fraugster/parquet-go/cmd/csv2parquet;