Skip to content

Instantly share code, notes, and snippets.

View altbodhi's full-sized avatar
🏠
Working from home

altbodhi

🏠
Working from home
View GitHub Profile
@altbodhi
altbodhi / TelegramWebApp.fsx
Created March 27, 2025 14:22
Check hash initData TelegramWebApp
module TelegramWebApp =
open System.Security.Cryptography
open System.Text
open System.Web
let validateInitData botToken (initData: string) =
let items =
initData.Split "&" |> Array.map (fun x -> let p = x.Split("=") in (p[0], p[1]))
@altbodhi
altbodhi / Text.find.fsx
Created April 5, 2025 07:35
Wirt Niklaus Example search in string via F#
module Text =
/// поиск индекс первого вхождения образца в строке
let findFirst (s: string) (p: string) =
// предикат проверяющий совпадение части строки с образцом
let eqSample i (s: string) (p: string) =
let rec loop j =
if j < p.Length && p.[j] = s.[i + j] then
loop (j + 1)
else