Skip to content

Instantly share code, notes, and snippets.

View zonca's full-sized avatar

Andrea Zonca zonca

View GitHub Profile
@zonca
zonca / healpy_harmonic_ud_grade_demo.ipynb
Last active February 13, 2026 05:21
healpy harmonic_ud_grade demo notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zonca
zonca / so_gaussian_fg_crosscheck.executed.ipynb
Created February 12, 2026 23:29
One-shot D_ell cross-check: so_gaussian_fg vs PySM Gaussian foregrounds
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
events = [
{"user_id":"u1","event_ts":"2024-01-31 23:30:00+00:00","event_type":"signup","amount_eur":None,"region":"Lazio"},
{"user_id":"u1","event_ts":"2024-02-01 00:10:00+00:00","event_type":"payment","amount_eur":"9.99","region":"Lazio"},
{"user_id":"u1","event_ts":"2024-03-01 12:00:00","event_type":"payment","amount_eur":9.99,"region":"Lazio"},
{"user_id":"u2","event_ts":"2024-02-15 08:00:00+01:00","event_type":"signup","amount_eur":None,"region":"Lombardia"},
{"user_id":"u2","event_ts":"2024-02-20 09:00:00+01:00","event_type":"payment","amount_eur":"bad","region":"Lombardia"},
{"user_id":"u2","event_ts":"2024-03-05 09:00:00+01:00","event_type":"payment","amount_eur":"19.99","region":"Lombardia"},
{"user_id":"u3","event_ts":"bad_ts","event_type":"signup","amount_eur":None,"region":"Sicilia"},
{"user_id":"u3","event_ts":"2024-03-10 10:00:00+01:00","event_type":"payment","amount_eur":"4.00","region":"Sicilia"}
]
@zonca
zonca / gist:4a755b452e1f7b82b3a1eb389be00cb8
Created February 9, 2026 16:50
Fake order data for pandas
{"order_id":"o1","ts":"2024-05-01 09:05:00+00:00","customer_id":"c1","segment":"SMB","amount":"19.99","status":"paid"},
{"order_id":"o2","ts":"2024-05-01 10:15:00+00:00","customer_id":"c2","segment":"Enterprise","amount":"250.00","status":"paid"},
{"order_id":"o3","ts":"2024-05-02 11:00:00+00:00","customer_id":"c1","segment":"SMB","amount":"-19.99","status":"refunded"},
{"order_id":"o4","ts":"2024-05-02 13:30:00+00:00","customer_id":"c3","segment":"SMB","amount":"39.99","status":"paid"},
{"order_id":"o5","ts":"2024-05-03 08:00:00+00:00","customer_id":"c4","segment":"Mid-Market","amount":"99.00","status":"paid"},
{"order_id":"o6","ts":"2024-05-03 09:00:00+00:00","customer_id":"c4","segment":"Mid-Market","amount":"99.00","status":"canceled"},
{"order_id":"o7","ts":"2024-05-04 16:45:00+00:00","customer_id":null,"segment":"SMB","amount":"10","status":"paid"},
{"order_id":"o8","ts":"bad_ts","customer_id":"c5","segment":"Enterprise","amount":"125.00","status":"paid"}
"#!/usr/bin/env bash\nset -euo pipefail\n\n# Target username (JupyterHub username)\nexport JH_USER=someuser\n\n# Required namespace (e.g., jhub)\n: \"${JH_NAMESPACE:?Set JH_NAMESPACE (e.g., export JH_NAMESPACE=jhub)}\"\n\n# Refuse to delete if the user's pod is still running (avoid stale NFS handles)\nif kubectl -n \"${JH_NAMESPACE}\" get pod \"jupyter-${JH_USER}\" >/dev/null 2>&1; then\n echo \"User pod jupyter-${JH_USER} is still running. Stop the server first, then re-run.\"\n exit 1\nfi\n\n# Clean up any prior job with the same name\nkubectl -n \"${JH_NAMESPACE}\" delete job \"delete-home-${JH_USER}\" --ignore-not-found\n\n# Generate Job configuration\ncat <<EOF2 > delete-user-home.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n name: delete-home-${JH_USER}\n namespace: ${JH_NAMESPACE}\nspec:\n backoffLimit: 1\n template:\n spec:\n restartPolicy: Never\n containers:\n - name: delete-home\n image: busybox:1.36\n command:\n - /bin/sh\n - -
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zonca
zonca / .bash_aliases
Last active January 8, 2026 00:04
Update Ubuntu/Debian Gemini-cli and Codex-cli
alias up="sudo apt update && sudo apt upgrade -y && rm -rf \$(npm config get prefix)/lib/node_modules/@google/.gemini-cli-* \$(npm config get prefix)/lib/node_modules/.codex-cli-* && npm install -g --force @google/gemini-cli codex-cli"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zonca
zonca / blm_gauss_change_notebook.ipynb
Last active December 11, 2025 18:18
Healpy blm_gauss breaking change comparison
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.