Skip to content

Instantly share code, notes, and snippets.

@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 / 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"
@lontivero
lontivero / Wasabito.md
Last active August 12, 2022 13:03
How to bring privacy to everyone

Note: not too long ago I shared a harsher version of this same content with the zkSNACKs internal staff. That document was for the team and for that reason a harsh language was okay but sadly for that same reason it is not publishable so, here I want to share the core ideas expressed at that time.


I've commented many times to different people inside as well as outside zkSNACKs how my vision about what Wasabi should be is quite different than the official one but I think I have never explained what that vision is and what that implies in practical/technical terms so, here I go.

@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 / Text.md
Last active June 14, 2022 07:01
A response to nothingmuch

A response to @nothingmuch

This is an unathorized and not solicited response to the short, but rather strong, tweets from @nothingmuch about the very-soon-comming Wasabi Wallet 2.0 release.

I feel the need to write here because @nothingmuch is the father of WabiSabi, the cryptographic protocol that makes Wasabi Wallet 2.0 new unequal-value outputs transactions possible, as well as the mind behind some critical components needed by the coinjoin implementation, and because, even though it could result in redundant to say, he's talented and a real expert in the field. Also, and this is the most important reason, i think, it's that even when it is evident he is not on good terms with the team, he is being honest in his concerns and then i cannot simply ignore what he says.

First, in my opinion tweets are good for saying what you want to say but are not very good for explaining