Skip to content

Instantly share code, notes, and snippets.

View fancellu's full-sized avatar

Dino Fancellu fancellu

View GitHub Profile
@fancellu
fancellu / README.md
Created December 3, 2025 17:08
Example scio/beam usage inside of ZIO

ZIO Beam WordCount

A simple word count program built with ZIO and Apache Beam/Scio that demonstrates retry logic and error handling.

Features

  • Counts words in a text file using Apache Beam
  • Built with ZIO for functional effect management
  • Includes retry logic with fixed delays
  • Simulates random failures for testing resilience
@fancellu
fancellu / OUTPUT.TXT
Created November 27, 2025 22:23
A batch streaming XSLT processor (batches them up into multiple files each with 2 orders)
2 files:
batch-1.xml
<?xml version="1.0" encoding="UTF-8"?><root><order id="ord-555" region="UK">
<line product-id="p1" qty="3"/>
</order><order id="ord-666" region="MARS">
<line product-id="p1" qty="1"/>
<line product-id="p2" qty="2"/>
<line product-id="p99" qty="1"/>
@fancellu
fancellu / bad.json
Last active November 27, 2025 21:22
Little XSLT 4.0 example using keys, maps, arrays
{
"items": [
{ "product":"Laptop", "qty":1, "line_total":1200 },
{ "product":"Mouse", "qty":2, "line_total":100 },
{ "error":"Product not found: p99", "product":"UNKNOWN", "qty":1, "line_total":0 }
],
"total_cost": 1300,
"order_id": "ord-666",
"tax_rate": 0
}
@fancellu
fancellu / app.py
Last active July 14, 2025 17:52
Huggingface Spaces Bitcoin Volume Plotly, interactive
import pandas as pd
import plotly.graph_objects as go
import gradio as gr
from io import StringIO
def create_interactive_bitcoin_chart(csv_text=None):
"""Create interactive Bitcoin volume chart from CSV data"""
try:
if csv_text and csv_text.strip():
@fancellu
fancellu / kontext_gpu_4bit.py
Last active July 18, 2025 11:51
Gradio demo for FluxContextDev but 4bit quant, fits on a 4090
import gradio as gr
import numpy as np
import spaces
import torch
import random
from PIL import Image
from diffusers import FluxKontextPipeline
from diffusers.utils import load_image
@fancellu
fancellu / README.md
Last active July 4, 2025 20:12
Kokoro-TTS-Zero-CPU
@fancellu
fancellu / README.md
Last active July 4, 2025 14:56
bark-pytorch2.6-compatible

https://huggingface.co/spaces/Fancellu/bark-pytorch2.6-compatible

This solves the PyTorch 2.6 breaking change where weights_only=True became the default, causing issues with older model files that contain non-tensor objects, with monkey patch patched_load()

Updated to Python 3.11, latest Gradio, and requirements.txt

If you have a GPU, you can run from Docker Desktop directly

docker run -it -p 7860:7860 --gpus=all --platform=linux/amd64 registry.hf.space/fancellu-bark-pytorch2-6-compatible:latest python app.py

@fancellu
fancellu / InterruptableReadLine.scala
Created September 27, 2024 21:16
InterruptableReadLine ZIO example of a readLine that can be timedout
import zio._
import scala.{ Console => SConsole }
import scala.io.StdIn
import java.io.{ BufferedReader, IOException }
import scala.util.Try
object InterruptableReadLine extends ZIOAppDefault {
def altReadLine(reader: BufferedReader = SConsole.in) =
ZIO
@fancellu
fancellu / FakeConsoleExample.scala
Created September 27, 2024 20:58
FakeConsoleExample zio supplying a fake Console
import zio._
object FakeConsoleExample extends ZIOAppDefault {
private val program = ZIO.serviceWithZIO[Console] { console =>
for {
_ <- console.printLine("Going to the grocery store")
input <- console.readLine("How are you? ")
_ <- console.printLine(s"You said: $input")
} yield ()
@fancellu
fancellu / dining.go
Last active September 30, 2024 21:49
Dining philosophers in golang (I have other impls in Rust, Scala, Scala+Cats effect here)
package main
import (
"fmt"
"math/rand"
"sync"
"time"
"unsafe"
)