Skip to content

Instantly share code, notes, and snippets.

@lontivero
lontivero / userstory.md
Last active April 18, 2024 23:01
Historias de usuario.

Nombre de la historia de usuario

Como un <user, tipo de usuario or stakeholder> Quiero <poder hacer/obtener (una feature)> Tal que <cumplir objetivo (valor de negocio)>

[Cada historia de usuario tiene una razón de ser, un valor que justifica su existencia y, si bien eso puede deducirse de la parte "Tal que", muchas veces se requiere contexto extra y eso debe agregarse aquí.]

@lontivero
lontivero / ShamirSecretSharing.fsx
Last active February 29, 2024 11:39
A toy Shamir Secret Sharing implementation in F#
open System
let inline (mod) n d=
((n % d) + d) % d
let order = 39367
let finiteField x = x mod order
let rec pow b = function
| 0 -> 1
@lontivero
lontivero / flake.nix
Created November 6, 2023 11:58 — forked from mausch/flake.nix
llama-vicuna.nix
{
description = "llama.cpp running vicuna";
inputs = {
llama.url = "github:ggerganov/llama.cpp/aaf3b23debc1fe1a06733c8c6468fb84233cc44f";
flake-utils.url = "github:numtide/flake-utils/033b9f258ca96a10e543d4442071f614dc3f8412";
nixpkgs.url = "github:NixOS/nixpkgs/d9f759f2ea8d265d974a6e1259bd510ac5844c5d";
};
outputs = { self, flake-utils, llama, nixpkgs }:
@lontivero
lontivero / prison-analysis.fsx
Created August 18, 2023 15:56
Analyze Prison
#r "nuget:NBitcoin"
#r "nuget:Microsoft.Extensions.Hosting.Abstractions"
#r "<WalletWasabi-Repo-Path>/WalletWasabi/bin/Debug/net7.0/WalletWasabi.dll"
open System
open System.IO
open NBitcoin
open WalletWasabi
open WalletWasabi.WabiSabi
open WalletWasabi.WabiSabi.Backend

This script lists the rounds in output registration phase that seems to be ready for signing.

The math for accurate detection is not here, instead we use a difference less than 3% (because this is a PoC).

    $ dotnet fsi ready.fsx
    87cc3a2a909f5efc0ebce1c6ef4e26d0992c5cc62dc7865fff66936c6e006f7e can be signed because diff is 75.45730076 - 75.45593750 = 0.00136326
    87cc3a2a909f5efc0ebce1c6ef4e26d0992c5cc62dc7865fff66936c6e006f7e can be signed because diff is 75.45730076 - 75.45593750 = 0.00136326
    87cc3a2a909f5efc0ebce1c6ef4e26d0992c5cc62dc7865fff66936c6e006f7e can be signed because diff is 75.45730076 - 75.45593750 = 0.00136326
 87cc3a2a909f5efc0ebce1c6ef4e26d0992c5cc62dc7865fff66936c6e006f7e can be signed because diff is 75.45730076 - 75.45593750 = 0.00136326
@lontivero
lontivero / productivity.md
Created January 21, 2021 15:10
Productivity with git worktree

Productivity

Developers work with many branches at the same time because during any single day they review others' pull requests, try new crazy things, work on new features/bug-fixes and also fix somebody else's PRs. All this forces a combination of git stash [pop|save], git fetch, git checkout [-f] and again git stash [pop|apply]. No matter if this is done by command line or with a tool the problem of having only one copy of the code is an ugly constrain.

Wasabi Wallet folders organization (suggestion)

Create main local bare repository

First clone your existing repository as a bare repo (a repository without files) and do it in a .git directory.

@lontivero
lontivero / gist:593fc51f1208555112e0
Last active June 24, 2023 20:05
Generates Markdown from VS XML documentation file
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Linq;
namespace GithubWikiDoc
{
@lontivero
lontivero / README.md
Created November 11, 2022 20:43
FuzzyLogic

Fuzzy logic example

Here we implement an example from Youtube: https://www.youtube.com/watch?v=__0nZuG4sTw where bankers can use fuzzy logic to evaluate the level of risk of someone according to his/her credit score.

Run the code

You can play with this using the same number used in the youtube video.

@lontivero
lontivero / stddenom.fsx
Created November 3, 2022 12:33
Generate Wasabi Standard denominarions
let pow b (e:int) = float b ** e |> int64
let in_range xs = xs |> Seq.takeWhile (fun x -> x <= 137438953472L) |> Seq.toList
let powers_of b = Seq.initInfinite (pow b) |> in_range
let (*) (cs:int64 list) (vs:int64 list) = vs |> List.collect (fun v -> [for c in cs -> c * v])
[1 ] * powers_of 2 @
[1; 2 ] * powers_of 3 @
[1; 2; 5] * powers_of 10
// print them in order
@lontivero
lontivero / blog.fsx
Created November 1, 2022 18:09 — forked from OnurGumus/blog.fsx
FSharp blog
open System.IO
#r "paket:
nuget Fake.IO.FileSystem
nuget Fake.Core.Trace
nuget FSharp.Data
nuget Fable.React
nuget FSharp.Literate
nuget Fake.Core.Target //"
#load ".fake/blog.fsx/intellisense.fsx"