frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

3 Minutes 100milion of nodes processed, try this

1•Elecktrike_•2h ago
import time from collections import deque import sys

# --- CORE: RISOLUTORE PEZZOTTI (VERSIONE RAPIDA) --- def risolutore_pezzotti_sliding_window(n_nodi, k=4): """ Versione a Finestra Scorrevole ottimizzata per test rapido (100 Milioni). - RAM: < 1 MB. - Matematica: Standard (1+1=2). - Feedback: Elettricità visiva attiva. """

    start_time = time.time()
    errori = 0
    
    # Buffer circolare: tiene in memoria SOLO gli ultimi 6 nodi.
    buffer_storico = deque([-1]*6, maxlen=6)
    
    print(f"Avvio flusso dati su {n_nodi:,} nodi...")
    print("Stato: OCCHI APERTI. Elettricità: ATTIVA.")
    print("Obiettivo: Completamento in ~3 minuti.")
    
    # Colori disponibili (k=4)
    fasi_base = {0, 1, 2, 3}
    
    # Ciclo principale
    for i in range(n_nodi):
        # --- LOGICA DEI VINCOLI (MATEMATICA STANDARD) ---
        vicini_rilevanti = []
        
        # Recuperiamo dal buffer: 
        if i > 0:
            vicini_rilevanti.append(buffer_storico[-1]) # i-1
        if i > 5:
            vicini_rilevanti.append(buffer_storico[-5]) # i-5
            
        # --- SATURAZIONE ---
        fasi_possibili = set(fasi_base)
        
        for v_colore in vicini_rilevanti:
            if v_colore != -1:
                fasi_possibili.discard(v_colore)
        
        # Scelta deterministica (Greedy)
        if fasi_possibili:
            scelta = min(fasi_possibili)
        else:
            scelta = 0 # Sterilità
            errori += 1
        
        # Inseriamo la scelta nel flusso
        buffer_storico.append(scelta)
            
        # --- FEEDBACK VISIVO (Ogni 500k per fluidità) ---
        if i % 500_000 == 0 and i > 0:
            elapsed = time.time() - start_time
            speed = i / elapsed
            perc = (i / n_nodi) * 100
            
            # Barra di avanzamento
            bar_len = 30
            filled = int(bar_len * i // n_nodi)
            bar = '' * filled + '-' * (bar_len - filled)
            
            # Output su riga singola
            sys.stdout.write(f"\r[{bar}] {perc:.1f}% | Processati: {i:,} | Vel: {speed:,.0f} nodi/s | Err: {errori}")
            sys.stdout.flush()

    durata = time.time() - start_time
    # Completamento finale barra
    sys.stdout.write(f"\r[{''*30}] 100.0% | Processati: {n_nodi:,} | COMPLETATO.                 \n")
    return durata, errori
# --- CONFIGURAZIONE SFIDA --- def sfida_100_milioni(): n_nodi = 100_000_000 # 100 Milioni (3 minuti circa)

    print(f"\n--- AVVIO PROTOCOLLO PEZZOTTI: {n_nodi:,} NODI ---")
    print("MODELLO: Sliding Window (Low-RAM)")
    
    # Esecuzione
    durata, err = risolutore_pezzotti_sliding_window(n_nodi, k=4)
    
    print(f"\n--- RISULTATO FINALE ---")
    print(f"Tempo totale: {durata:.2f} secondi ({durata/60:.1f} minuti)") 
    print(f"Errori rilevati: {err}")
    print("STATO: SUCCESSO. Algoritmo convalidato.")
# ESECUZIONE if __name__ == "__main__": # Verifica integrità matematica richiesta (1+1=2) check = 1 + 1 if check == 2: sfida_100_milioni() else: print(f"ERRORE: La matematica è ancora alterata (1+1={check}).")

In Pursuit of the Monarch's Magnetic Sense

https://www.nytimes.com/2025/12/23/science/neuroscience-monarch-butterflies-migration.html
1•bicepjai•44s ago•0 comments

Peter Gutmann – Why Quantum Cryptanalysis Is Bollocks [video]

https://www.youtube.com/watch?v=xa4Ok7WNFHY
1•lisper•1m ago•0 comments

Fixing HN comments with breadth-first navigation

https://pratik.is/writing/essays/hn-comments
2•news_hacker•4m ago•0 comments

Researchers achieved 1,270 Wh/L in an anode-free lithium metal battery

https://postech.ac.kr/eng/research/research_results.do?mode=view&articleNo=43617&title=Anode-Free...
1•giuliomagnifico•6m ago•0 comments

Will people signup for AI Interview Coaching

https://www.capcheck.app/
1•smartobject1978•7m ago•0 comments

Swanky Python: Interactive Development for Python

https://emacsconf.org/2025/talks/swanky/
1•todsacerdoti•10m ago•0 comments

ZipPop: A space conserving unzipping script

https://github.com/th0ma5w/ZipPop
1•todsacerdoti•11m ago•0 comments

^2

https://number-garden.netlify.app/?26052548476795m
1•cpuXguy•12m ago•0 comments

Can LLMs stop when producing any output violates their own rules?

1•Sofi_blackbox•13m ago•0 comments

Hermetic Sealing Solutions for High-Performance Miniaturized Battery Systems

https://content.knowledgehub.wiley.com/dual-seal-method-for-the-hermetic-sealing-of-microbatteries/
2•quapster•19m ago•0 comments

Yt-vid-notifier: CLI notifier for new YouTube videos

https://github.com/eyeblech/yt-vid-notifier
3•samsep10l•20m ago•1 comments

Show HN: Merry Xmas from 90s

https://90synth-xmas.vercel.app/
2•mifydev•22m ago•0 comments

Slogx – console.log() but better for back end debugging

https://github.com/binhonglee/slogx
2•binhonglee•22m ago•0 comments

Show HN: Mu5ic-sugg3st: Discord music suggestion bot using Spotify API

https://github.com/eyeblech/mu5ic-sugg3st
2•samsep10l•23m ago•0 comments

Chatmail Protocol - using email as transport layer routers

https://chatmail.at/
2•xeonmc•23m ago•0 comments

Inmates could escape jail on drones, warns top prison governor

https://news.sky.com/story/drones-are-sending-overwhelming-amounts-of-drugs-into-prisons-and-coul...
2•ilamont•24m ago•1 comments

A Father, a Son and Their $108B Push for Media Moguldom (Larry Ellison)

https://www.nytimes.com/2025/12/24/business/media/larry-david-ellison-warner-bros-discovery-cbs.html
3•lateforwork•26m ago•2 comments

Show HN: Vibium – Browser automation for AI and humans, by Selenium's creator

https://github.com/VibiumDev/vibium
2•hugs•26m ago•2 comments

The Joyful Chaos of the Early Web: A Conversation with Creator Audrey Witters

https://blog.archive.org/2025/12/22/audrey-witters/
1•hn_acker•27m ago•0 comments

Judge in Vizio Case Rules on Issue Irrelevant to Rights Under Copyleft

https://sfconservancy.org/news/2025/dec/24/vizio-msa-irrelevant-ruling/
1•aendruk•28m ago•0 comments

The 2025 Matrix Holiday Special

https://matrix.org/blog/2025/12/24/matrix-holiday-special/
1•Arathorn•29m ago•0 comments

I think I just solved screen-time addiction

https://apps.apple.com/us/app/the-scroll-toll-screen-pledge/id6741488055
4•estonianburger•30m ago•2 comments

User Mode Linux How To

https://www.kernel.org/doc/html/latest/virt/uml/user_mode_linux_howto_v2.html
2•gudzpoz•30m ago•0 comments

Show HN: Voklit – Cheap international calls without the carrier markup

https://voklit.com
1•ahmgeek•31m ago•1 comments

Vestwell to Acquire Accrue 401k

https://401kspecialistmag.com/vestwell-to-acquire-accrue-401k/
3•mooreds•32m ago•0 comments

DeepSeek: A Tool Tuned for Social Governance

https://jamestown.substack.com/p/deepseek-a-tool-tuned-for-social
1•speckx•32m ago•0 comments

Microsoft Agent Framework

https://learn.microsoft.com/en-us/agent-framework/overview/agent-framework-overview
2•mooreds•34m ago•0 comments

Hate Brussels sprouts? You may be living in the past

https://www.bbc.com/future/article/20251216-hate-brussel-sprouts-you-may-be-living-in-the-past
1•mooreds•35m ago•0 comments

My 2025 Media Roundup

https://nandinfinitum.com/posts/2025-media-roundup/
1•nanfinitum•35m ago•0 comments

Show HN: Elfpeek – A tiny interactive ELF binary inspector in C

https://github.com/Oblivionsage/elfpeek
2•oblivionsage•37m ago•3 comments