This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// controller | |
[HttpGet("tgCheckWebAppAuth")] | |
public async Task<IActionResult> CheckWebAppAuth([FromQuery] Dictionary<string, string> userData) | |
{ | |
var user = telegramLoginUrl.CheckWebAppTelegramAuthorization(userData); | |
if (await Invalid(user)) return Unauthorized(); | |
await SignIn(user, [new Claim("Source", "TelegramWebApp")]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@page "/" | |
@rendermode InteractiveServer | |
<input value="@query" @oninput="OnInput" /> | |
@if (isGetItems) | |
{ | |
<div style="font-style: italic;">поиск...</div> | |
} | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
type Message<'a> = | |
| Get of AsyncReplyChannel<'a> | |
| Update of AsyncReplyChannel<'a> * ('a -> 'a) | |
type Atom<'a>(o: 'a) = | |
let agent = | |
MailboxProcessor.Start(fun b -> | |
let rec loop (acc) = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<MudButton ButtonType="ButtonType.Button" OnClick="BeepIfIncomingMessage">OK</MudButton> | |
@code { | |
async Task BeepIfIncomingMessage() | |
{ | |
if (jsSoundUtils == null) | |
jsSoundUtils = await JS.InvokeAsync<IJSObjectReference>("import", "./js/SoundUtils.js"); | |
var res = await jsSoundUtils.InvokeAsync<object>("soundBeep"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ZenUtil | |
#r "nuget: NAudio" | |
#r "nuget: System.Speech" | |
open NAudio.Wave | |
open System | |
module WindowsSpeech = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
Для запуска на виднос выполнить команду: | |
dotnet fsi --exec githubEvents.fsx | |
*) | |
#r "nuget: FSharp.Data" | |
open FSharp.Data | |
let [<Literal>] url = "https://api.github.com/networks/radzenhq/radzen-blazor/events" | |
type Events = JsonProvider<url> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "nuget: FSharp.Data, 5.0.2" | |
open System | |
open System.Diagnostics | |
open FSharp.Data | |
open System.IO | |
let [<Literal>] feedUrl = "https://peapix.com/bing/feed" | |
type BingoImage = JsonProvider<feedUrl> | |
let out = Path.Combine(__SOURCE_DIRECTORY__, "bing") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
2_000_000 => 16 sec | |
5_ => 32 | |
10_ => 1:10 | |
20_ => 2:58 | |
40_ => 13:44 file size = 2.5 Gb | |
*/ | |
using System.IO; | |
using System.Diagnostics; |
NewerOlder