text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_suffix|>inerSubnet" prefix "10.30.41.0/24" add_delegations [ SubnetDelegationService.ContainerGroups ] } ] } networkProfile { name "ne...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module ContainerRegistry open Expecto open Farmer open Farmer.ContainerRegistry open Farmer.Builders open System.Collections.Generic type RegistryJson = { resources: {| name: string ``type``: string apiVersion: string sku: {| name: string |} ...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module ContainerService open Expecto open Farmer.Arm open Farmer.Arm.ContainerService.AddonProfiles open Farmer.Arm.ContainerService open Farmer.Arm.RoleAssignment open Farmer.Builders open Farmer open Microsoft.Azure.Management.Compute.Models open Microsoft.Azure.Management.ContainerService open Microso...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module Cosmos open Expecto open Farmer open Farmer.Builders open Farmer.Storage open Farmer.Arm.DocumentDb let tests = testList "Cosmos" [ test "Cosmos container should ignore duplicate unique keys" { let container = cosmosContainer { name "people" ...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module Dashboards open Expecto open Farmer open Farmer.Insights open Farmer.Builders let tests = testList "Dashboards" [ test "Create a simple dashboard" { // https://docs.microsoft.com/en-us/azure/azure-portal/azure-portal-dashboards-structure let vm = vm { ...
fim
CompositionalIT/farmer
fsharp
<|fim_suffix|> let actualPrometheusForwarder = jobj.SelectToken("resources[?(@.name=='myRule')].properties.dataSources.prometheusForwarder").ToString() Expect.equal isLinux "Linux" "Expected Linux OS type" Expect.equal actualEndpoint ((myEndpoint :> IBuilder).Resourc...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module Databricks open Expecto open Farmer open Farmer.Arm.Databricks open Farmer.Arm.KeyVault open Farmer.Arm.Network open Farmer.Builders.Databricks open Farmer.Builders.VirtualNetwork open Farmer.Databricks open System type ValueObj<'T> = {| value: 'T |} type WorkspaceJson = { name: string d...
fim
CompositionalIT/farmer
fsharp
<|fim_suffix|>should have one availability zone" Expect.contains zones "1" "The zones should contain zone 1" () } ]<|fim_prefix|>module DedicatedHosts open Expecto open Farmer open Farmer.Builders open Farmer.DedicatedHosts open Microsoft.Azure.Management.Compute open Microsoft.R...
fim
CompositionalIT/farmer
fsharp
module DeploymentScript open Expecto open Farmer open Farmer.Arm.DeploymentScript open Farmer.Arm.Storage open Farmer.Builders let tests = testList "deploymentScripts" [ test "creates a script" { let script = deploymentScript { name "some-script" arguments [ "fo...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module DiagnosticSettings open Expecto open Farmer open Farmer.Arm.Storage open Farmer.Arm.LogAnalytics open Farmer.Arm.EventHub open Farmer.DiagnosticSettings open Farmer.Builders open Microsoft.Azure.Management.OperationalInsights open Microsoft.Azure.Management.Monitor.Models open Microsoft.Rest open...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module Disk open Expecto open Farmer open Farmer.Builders open Newtonsoft.Json.Linq let tests = testList "Disk Tests" [ test "Import disk builder from VHD" { let deployment = arm { add_resources [ disk { name "imported-d...
fim
CompositionalIT/farmer
fsharp
module Dns open Expecto open Farmer open Farmer.Builders open System open Farmer.Dns open Microsoft.Rest open Microsoft.Azure.Management.Dns open Microsoft.Azure.Management.Dns.Models open Newtonsoft.Json.Linq let client = new DnsManagementClient(Uri "http://management.azure.com", TokenCredentials "NotNullOrWhite...
fim
CompositionalIT/farmer
fsharp
module DnsResolver open Expecto open Farmer open Farmer.Builders open Farmer.Network open Newtonsoft.Json.Linq let tests = testList "DNS Resolver Tests" [ test "Basic resolver with single inbound endpoint" { let deployment = arm { add_resources [ vnet { ...
fim
CompositionalIT/farmer
fsharp
<|fim_suffix|> sub.Endpoint (EndpointType.ServiceBus(ServiceBusEndpointType.Topic { Topic = t.Name; Bus = bus.Name })) "Incorrect endpoint type" Expect.equal sub.Destination t.Name "Incorrect destination" } ]<|fim_prefix|>module EventGrid open Expecto open ...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module EventHub open Expecto open Farmer open Farmer.Builders open Farmer.EventHub let tests = testList "EventHub" [ test "Gets key on a Hub correctly" { let hub = eventHub { name "foo" } Expect.equal <|fim_suffix|> Expect.equal h...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module ExpressRoute open Expecto open Farmer open Farmer.Builders open Farmer.ExpressRoute open Microsoft.Azure.Management.Network open Microsoft.Azure.Management.Network.Models open Microsoft.Rest open Newtonsoft.Json.Linq open System let client = new NetworkManagementClient(Uri "http://management....
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module Functions open Expecto open Farmer open Farmer.Builders open Farmer.Arm open Microsoft.Azure.Management.WebSites open Microsoft.Azure.Management.WebSites.Models open Microsoft.Rest open System open Farmer.WebApp open Farmer.Identity let getResource<'T when 'T :> IArmResource> (data: IArmResource ...
fim
CompositionalIT/farmer
fsharp
module Gallery open System open Expecto open Farmer open Farmer.Builders open Farmer.Arm.Gallery open Newtonsoft.Json.Linq let tests = testList "Image Gallery" [ test "Builds basic image gallery" { let deployment = arm { location Location.EastUS add_resources [...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>[<AutoOpen>] module TestHelpers open Farmer open Microsoft.Rest.Serialization let createSimpleDeployment parameters = { Location = Location.NorthEurope PostDeployTasks = [] Template = { Outputs = [] Parameters = parameters |> List.map SecureParameter Resources = [] ...
fim
CompositionalIT/farmer
fsharp
module Identity open Expecto open Farmer open Farmer.Arm open Farmer.Identity open Farmer.Builders open Newtonsoft.Json.Linq let tests = testList "Identity" [ test "Can add two identities together" { let systemOnly = { ManagedIdentity.Empty with SystemAssign...
fim
CompositionalIT/farmer
fsharp
<|fim_suffix|>Id" Expect.equal distribute.[1].["runOutputName"] (JValue "shared-image-run") "Incorrect 'runOutputName' for shared iamge distributor" Expect.equal (distribute.[1].SelectToken "artifactTags.image-type") ...
fim
CompositionalIT/farmer
fsharp
<|fim_suffix|> capacity 2 partition_count 2 retention_days 3 } arm { add_resource hub } |> findAzureResources<IotHubDescription> iotClient.SerializationSettings |> List.head Expect.equal resource....
fim
CompositionalIT/farmer
fsharp
module JsonRegression open Expecto open DiffPlex.DiffBuilder open DiffPlex.DiffBuilder.Model open Farmer open Farmer.Arm open Farmer.AzureFirewall open Farmer.Builders open Farmer.Network open Farmer.ServiceBus open System open System.IO let private differ = SideBySideDiffBuilder(DiffPlex.Differ()) /// Prints a diff...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module KeyVault open Expecto open Farmer.Builders open Farmer.KeyVault open Farmer.Arm.RoleAssignment open System open Farmer open Newtonsoft.Json.Linq let tests = testList "KeyVault" [ test "Can create secrets without popping" { secret { name "test" } |> ignore } test "Can create qu...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module LoadBalancer open Expecto open Microsoft.Azure.Management.Network open Microsoft.Rest open System open Farmer open Farmer.LoadBalancer open Farmer.Builders open Newtonsoft.Json.Linq let client = new NetworkManagementClient(Uri "http://management.azure.com", TokenCredentials "NotNullOrWhiteSpa...
fim
CompositionalIT/farmer
fsharp
<|fim_suffix|>ention In Days" } test "Ingestion and Query are disabled by default" { let workspace = logAnalytics { name "" } |> asAzureResource Expect.equal workspace.RetentionInDays (Nullable()) "Retention Period should be off by default" Expect.equal workspace.Pu...
fim
CompositionalIT/farmer
fsharp
module LogicApps open Expecto open Farmer open Farmer.Arm open Farmer.Builders open Farmer.Helpers open Microsoft.Azure.Management.Logic open Microsoft.Azure.Management.Logic.Models open Microsoft.Rest open System open System.Text.Json let dummyClient = new LogicManagementClient(Uri "http://management.azure.com",...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module Maps open Expecto open Farmer open Farmer.Builders open Farmer.Maps open System open <|fim_suffix|>ent.SerializationSettings |> List.head resource.Validate() Expect.equal resource.Name "mymaps" "" Expect.equal resource.Sku.Name "S0" "" }...
fim
CompositionalIT/farmer
fsharp
<|fim_suffix|>rceId vnetName) prefix "10.28.1.0/24" depends_on (subnets.resourceId (ResourceName vnetName / ResourceName "subnet1")) } ] } let jobj = template.Template |> Writer.toJson |> Newtonsoft.Json.Linq.JO...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module NetworkManager open Expecto open Farmer op<|fim_suffix|>"my-manager/baseline-config/baseline-rules" "Rule collection name should match" // Verify rules let ruleResources = resources |> Seq.filter (fun r -> ...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module NetworkSecurityGroup open Expecto open Farmer open Farmer.NetworkSecurity open Farmer.Arm.NetworkSecurityGroup open Farmer.Builders open Farmer.Vm open Microsoft.Azure.Management.Network open Microsoft.Azure.Management.Network.Models open Microsoft.Rest open System open Newtonsoft.Json.Linq let c...
fim
CompositionalIT/farmer
fsharp
module OperationsManagement open System open Expecto open Farmer open Farmer.Builders open Newtonsoft.Json.Linq let tests = testList "Operations Management Solution" [ test "Generates an operations management soluution" { let sentinelWorkspace = logAnalytics { name "my-sentine...
fim
CompositionalIT/farmer
fsharp
<|fim_suffix|>ust right" } test "Capacity can be validated" { Expect.throws (fun () -> Validate.capacity 0<VCores>) "Capacity too small" Expect.throws (fun () -> Validate.capacity 128<VCores>) "Capacity too large" Expect.throws (fun () -> Validate.capacity 13<VCores>...
fim
CompositionalIT/farmer
fsharp
module PrivateLink open Expecto open Farmer open Farmer.Builders open Newtonsoft.Json.Linq let tests = testList "Private Link" [ test "Creates a private link service for a load balancer" { let vnet = vnet { name "private-net" add_address_spaces [ "10.100.0.0/16"...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module PrometheusRuleGroup open Expecto open Farmer open Farmer.Builders open Farmer.Arm.InsightsAlerts let tests = testList "Prometheus Rule Group" [ test "Create prometheus rule group with rules" { let myRule1 = prometheusRule { record ("myRecord") ...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module ResourceGroup open Expecto open Farmer open Farmer.Arm.ResourceGroup open Farmer.Builders let tests = testList "Resource Group" [ test "Creates a resource group" { let rg = createResourceGroup "myRg" Location.EastUS Ex<|fim_suffix|>tion.EastUS "Incorrect locati...
fim
CompositionalIT/farmer
fsharp
<|fim_suffix|>ns (Newtonsoft.Json.JsonConvert.SerializeObject actual.JsonModel) "\"scope\":\"[resourceId('Microsoft.AVS/privateClouds', 'mySDDC')]\"" } ]<|fim_prefix|>module RoleAssignment open Expecto open Farmer open Farmer.Arm let tests = testList "RoleAssignment" [ ...
fim
CompositionalIT/farmer
fsharp
<|fim_suffix|>"serviceBus" sku (Premium MessagingUnits.OneUnit) enable_zone_redundancy } ) } let jobj = parseTemplate resourceGroup Expect.equal (jobj.SelectToken($"resources[0].prop...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module ServicePlan open Expecto open Farmer open Farmer.Builders open Farmer.Arm open System let getResource<'T when 'T :> IArmResource> (data: IArmResource list) = data |> List.choose (function | :? 'T as x -> Some x | _ -> None) let getResources (v: IBuilder) = v.BuildResourc...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module SignalR open System.Text.RegularExpressions open Expecto open Farmer open Farmer.Builders open Farmer.SignalR open System open Microsoft.Azure.Management.Compute.Models open Microsoft.Azure.Management.SignalR open Microsoft.Azure.Management.SignalR.Models open Microsoft.Rest let client = new ...
fim
CompositionalIT/farmer
fsharp
<|fim_suffix|>with dash" check "zz-" "cannot end with a dash (-). The invalid value is 'zz-'" "End with dash" } test "Sets Min TLS version correctly" { let sql = sqlServer { name "server" admin_username "isaac" add_databases [ ...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module StaticWebApp open Expecto open Farmer open Farmer.Builders open Farmer.WebApp open Farmer.Arm open System let tests = testList "Static Web App Tests" [ test "Creates a basic static web app" { let swa = staticWebApp { name "foo" api_location ...
fim
CompositionalIT/farmer
fsharp
<|fim_suffix|>//compositional-it.com" ], [ GET ], 15, [ "exposed1"; "exposed2" ], [ "ALLOWED1"; "ALLOWED2" ] ) ] } let rules = (account |> findProp...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module Template open Expecto open Farmer open Farmer.Builders open Farmer.Arm open TestHelpers open Microsoft.Azure.Management.ResourceManager open Microsoft.Rest open System open Newtonsoft.Json.Linq let toTemplate (deployment: IDeploymentSource) = deployment.Deployment.Template |> Writer.TemplateG...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module Traff<|fim_suffix|> |> List.head Expect.equal resource.Name tmName "Profile name does not match" Expect.equal resource.DnsConfig.Ttl (Nullable(int64 30)) "Default DNS TTL is incorrect" Expect.equal resource.TrafficRoutingMethod ...
fim
CompositionalIT/farmer
fsharp
<|fim_suffix|>esourceGroup emits correct ARM expression" { Expect.equal Location.ResourceGroup.ArmValue "[resourceGroup().location]" "Incorrect expression emitted for Location.ResourceGroup" } test "Default location for 'arm' builder uses resou...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module VirtualHub open Expecto open Farmer open Farmer open Farmer.Arm.VirtualHub open Farmer.Builders open Farmer.VirtualHub open Farmer.VirtualHub.HubRouteTable open Microsoft.Azure.Management.Network open Microsoft.Azure.Management.Network.Models open Microsoft.Rest open System open Microsoft.Rest.Ser...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module VirtualMachine open Expecto open Farmer open Farmer.Builders open Farmer.Vm open Microsoft.Azure.Management.Compute open Microsoft.Azure.Management.Compute.Models open Microsoft.Rest open System open Microsoft.Azure.Management.WebSites.Models open Newtonsoft.Json.Linq /// Client instance needed t...
fim
CompositionalIT/farmer
fsharp
<|fim_suffix|> Address = Net.IPAddress.Parse "10.32.1.0" Prefix = 24 } ] "Incorect client pools" } test "Can create a VirtualNetworkGateway with root cert" { let b = gateway { ...
fim
CompositionalIT/farmer
fsharp
module VirtualWan open Expecto open Farmer open Farmer.Arm open Farmer.Builders open System open Microsoft.Azure.Management.Network open Microsoft.Azure.Management.Network.Models open Microsoft.Rest /// Client instance so we can get the JSON serialization settings. let client = new NetworkManagementClient(Uri "ht...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module VmScaleSet open Expecto open Farmer open Farmer.Builders open Farmer.Vm open Farmer.VmScaleSet open Newtonsoft.Json.Linq let tests = testList "Virtual Machine Scale Set" [ test "Create a basic scale set with autogenerated vnet" { let deployment = arm { add_...
fim
CompositionalIT/farmer
fsharp
<|fim_prefix|>module WebApp open Expecto open Farmer open Farmer.Builders open Farmer.Identity open Farmer.WebApp open Farmer.Arm open Microsoft.Azure.Management.WebSites open Microsoft.Azure.Management.WebSites.Models open Microsoft.Rest open System let getResource<'T when 'T :> IArmResource> (data: IArmResource lis...
fim
CompositionalIT/farmer
fsharp
<|fim_suffix|>methods, but you'll need to catch them manually near the API boundary or the app will crash. // C++ doesn't have an ABI, the framework can't catch C++ exception across the modules. const HRESULT m_code; public: Exception( HRESULT hr ) : runtime_error( "ComLight HRESULT exception" ), m_code( hr ) ...
fim
Const-me/Whisper
cpp
<|fim_prefix|>#pragma once namespace ComLight { // COM smart pointer, very comparable to CComPtr from ATL template <class I> class CComPtr { I* p; void callAddRef() const { if( nullptr == p ) return; p->AddRef(); } public: // Construct with nullptr CComPtr() : p( nullptr ) { } // Relea...
fim
Const-me/Whisper
cpp
<|fim_suffix|>} } #ifdef IID_PPV_ARGS #undef IID_PPV_ARGS #endif #define IID_PPV_ARGS( pp ) decltype( **pp )::iid, ::ComLight::details::castDoublePointerToVoid( pp )<|fim_prefix|>#pragma once #include "comLightCommon.h" #include "client/CComPtr.hpp" #include "utils/typeTraits.hpp" nam<|fim_middle|>espace ComLight { ...
fim
Const-me/Whisper
c
<|fim_prefix|>#pragma once #include "hresult.h" #ifdef _MSC_VER #include <guiddef.h> #else #include "<|fim_suffix|>*; #endif #include "unknwn.h"<|fim_middle|>pal/guiddef.h" using LPCTSTR = const char<|endoftext|>
fim
Const-me/Whisper
c
<|fim_prefix|>#pragma once #include "comLightCommon.h" #include "client/CComPtr.hpp" #include "<|fim_suffix|>_MSC_VER // On Windows, it's controlled by library.def module definition file. There's __declspec(dllexport), but it adds underscore, I don't like that. #define DLLEXPORT extern "C" #else #define DLLEXPORT exte...
fim
Const-me/Whisper
c
<|fim_prefix|>#pragma once #include <stdint.h> #ifdef _MSC_VER #include <winerror.h> #include <OleCtl.h> #else #include "pal/hresult.h" #endif #define CHECK( hr ) { cons<|fim_suffix|>hr ) ) return __hr; } #ifndef _MSC_VER inline constexpr HRESULT HRESULT_FROM_WIN32( int c ) { return c < 0 ? c : ( ( 0xFFFF & c ) | 0x...
fim
Const-me/Whisper
c
<|fim_suffix|>D = const GUID&;<|fim_prefix|>#pragma once #include <stdint.h> #include <array> #ifndef GUID_DEFINED #define GUID_DEFINED #endif struct GUID { uint32_t Data1; uint16_t Data2; uint16_t Data3; std::array<uint8_t, 8> Data4; constexpr inline bool oper<|fim_middle|>ator==( const GUID& that ) const { ...
fim
Const-me/Whisper
c
<|fim_prefix|>#pragma once #include <stdint.h> using HRESULT = int32_t; #define _HRESULT_TYPEDEF_(_sc) ((HRESULT)_sc) #define SEVERITY_ERROR 1 #define FACILITY_CONTROL 10 inline constexpr HRESULT MAKE_SCODE( <|fim_suffix|>ASSNOTAVAILABLE _HRESULT_TYPEDEF_(0x80040111L) #define CLASS_E_NOAGGREGATION ...
fim
Const-me/Whisper
c
<|fim_prefix|>#pragma once #include <type_traits> #include "../comLightClient.h" #include "../utils/typeTraits.hpp" #include "../Exception.hpp" namespace ComLight { namespace details { GENERATE_HAS_MEMBER( implQueryInterface ); GENERATE_HAS_MEMBER( implAd<|fim_suffix|>s assumed to take ownership of the new objec...
fim
Const-me/Whisper
cpp
<|fim_suffix|>ies, IUnknown and I. bool implQueryInterface( REFIID riid, void** ppvObject ) { if( riid == I::iid() || riid == IUnknown::iid() ) { I* const result = this; result->AddRef(); *ppvObject = result; return true; } return false; } }; }<|fim_prefix|>#pragma once #include "RefC...
fim
Const-me/Whisper
cpp
<|fim_suffix|>ter { std::atomic_uint referenceCounter; public: RefCounter() : referenceCounter( 0 ) { } inline virtual ~RefCounter() { } RefCounter( const RefCounter &that ) = delete; RefCounter( RefCounter &&that ) = delete; protected: uint32_t implAddRef() { return ++referenceCounter; } ...
fim
Const-me/Whisper
cpp
<|fim_suffix|>ler ) return false; const HRESULT hr = marshaller->QueryInterface( IID_IMarshal, ppvObject ); return SUCCEEDED( hr ) ? true : false; } #endif<|fim_prefix|>#include "freeThreadedMarshaller.h" #ifdef _MSC_VER #include <combaseapi.h> HRESULT ComLight::details::createFreeThreadedMarshaller( IUnknown* pUn...
fim
Const-me/Whisper
cpp
<|fim_prefix|>#pragma once #ifdef _MSC_VER #include "../comLightCommon.h" namespace ComLight { namespace details { HRESULT createFreeThreadedMarshaller( IUnknown* pUnkOuter, IUnknown** ppUnkMarshal ); bool queryMarshallerInterface( REFIID riid<|fim_suffix|>Light::IUnknown> m_freeThreadedMarshaller; ...
fim
Const-me/Whisper
c
<|fim_prefix|>#pragma once #include "../utils/typeTraits.hpp" // Unlike ATL, the interface map is optional for ComLight. // If you won't declare a map, the object will support 2 interfaces: IUnknown, and whatever template argument was passed to ObjectRoot class. #define BEGIN_COM_MAP() <|fim_suffix|>etails {...
fim
Const-me/Whisper
c
<|fim_prefix|>#pragma once #include <vector> #include "comLightCommon.h" // COM interfaces to marshal streams across the interop. namespace ComLight { enum struct eSeekOrigin : uint8_t { Begin = 0, Current = 1, End = 2 }; namespace details { template<class E> inline size_t sizeofVector( const std::vect...
fim
Const-me/Whisper
c
<|fim_prefix|>#pragma once #include <type_traits> // Calling conventions #ifdef _MSC_VER #define COMLIGHTCALL __stdcall #define DECLSPEC_NOVTABLE __declspec(nov<|fim_suffix|> struct DECLSPEC_NOVTABLE IUnknown { DEFINE_INTERFACE_ID( "00000000-0000-0000-c000-000000000046" ); virtual HRESULT COMLIGHTCALL QueryInt...
fim
Const-me/Whisper
c
<|fim_prefix|>// https://github.com/tobias-loew/cons<|fim_suffix|> + 1 + 4 + 1 + 4 + 1 + 2 + 2 + 1 + 2 + 2 ), parse_hex_uint8_t( begin + 8 + 1 + 4 + 1 + 4 + 1 + 2 + 2 + 1 + 2 + 2 + 2 ), parse_hex_uint8_t( begin + 8 + 1 + 4 + 1 + 4 + 1 + 2 + 2 + 1 + 2 + 2 + 2 + 2 ), parse_hex_uint8_t( begin + 8 + 1 + 4 + ...
fim
Const-me/Whisper
cpp
<|fim_suffix|>ct has_member_##member \ : public std::integral_constant<bool, HasMember_##member<T>::RESULT> \ { \ }; <|fim_prefix|>#pragma once #include <type_traits> name...
fim
Const-me/Whisper
cpp
<|fim_suffix|>puteShaders() { }<|fim_prefix|>vo<|fim_middle|>id fnCom<|endoftext|>
fim
Const-me/Whisper
cpp
<|fim_prefix|>using System.Runtime.ExceptionServices; using Whisper; namespace MicrophoneCS { sealed cl<|fim_suffix|>nly Thread thread; readonly Context context; readonly iAudioCapture source; ExceptionDispatchInfo? edi = null; void threadMain() { try { context.runCapture( source, callbacks, thi...
fim
Const-me/Whisper
csharp
<|fim_prefix|>using System.Globalization; using System.Reflection; using Whisper; namespace MicrophoneCS { sealed record class CommandLineArgs { public int n_threads = Environment.ProcessorCount; public int offset_t_ms = 0; public int offset_n = 0; public int duration_ms = 0; public int max_context = -1; ...
fim
Const-me/Whisper
csharp
<|fim_suffix|>sCaptureParams cp = new sCaptureParams( true ); if( cla.diarize ) cp.flags |= eCaptureFlags.Stereo; using iAudioCapture captureDev = mf.openCaptureDevice( devices[ cla.captureDeviceIndex ], cp ); using iModel model = Library.loadModel( cla.model ); using Context context = model.creat...
fim
Const-me/Whisper
csharp
<|fim_prefix|>using System.Globalization; using Whisper; namespace MicrophoneCS { /// <summary>Implementation of Callbacks abstract class, to print these segments as soon as they’re produced by the library.</summary> sealed class Transcrib<|fim_suffix|>--> {1}] {2} ", printTime( seg.time.begin ), printTime( seg.tim...
fim
Const-me/Whisper
csharp
<|fim_suffix|>( const char8_t* pszFormat, ... ) { LOG_MESSAGE_IMPL( "Info" ); } void logDebug( const char8_t* pszFormat, ... ) { LOG_MESSAGE_IMPL( "Debug" ); }<|fim_prefix|>#include <stdint.h> #include <vector> #include <cstdarg> #include "Logger.h" namespace { void logMessage( const char* lvl, const char8_t* pszF...
fim
Const-me/Whisper
cpp
<|fim_suffix|>t, ... ); #ifdef __cplusplus } namespace Tracing { struct ItemName { ItemName( const char* str ) { } ItemName( const char* str, uint32_t a0 ) { } ItemName( const char* str, int a0 ) { } }; inline void tensor( const ItemName& name, const ggml_tensor* tensor ) { } inline void delayTensor( con...
fim
Const-me/Whisper
c
<|fim_prefix|>#include "whisper.h" // third-party utilities // use your favorite implementations #define DR_WAV_IMPLEMENTATION #include "dr_wav.h" #include <cmath> #include <fstream> #include <cstdio> #include <string> #include <thread> #include <vector> // Terminal color map. 10 colors grouped in ranges [0.0, 0.1, ...
fim
Const-me/Whisper
cpp
<|fim_prefix|>using System.Runtime.InteropServices; /// <summary>Utility class to setup console coloring with ANSI codes.</summary> /// <remarks>The feature requires Windows 10 or newer</remarks> static class AnsiCodes { const string dll = "kernel32.dll"; [DllImport( dll, SetLastError = true )] static extern IntP...
fim
Const-me/Whisper
csharp
<|fim_prefix|>using System.Globalization; using System.Reflection; using Whisper; namespace TranscribeCS { sealed record class CommandLineArgs { public int n_threads = Environment.ProcessorCount; public int offset_t_ms = 0; public int offset_n = 0; public int duration_ms = 0; public int max_context = -1; ...
fim
Const-me/Whisper
csharp
<|fim_prefix|>using System.Globalization; using Whisper; namespace TranscribeCS { /// <summary>Implementation of Callbacks abstract class, to print these segments as soon as they’re produced by the library.</summary> sealed class Transcribe: Callbacks { readonly CommandLineArgs args; readonly eResultFlags resu...
fim
Const-me/Whisper
csharp
<|fim_suffix|> = segments[ i ]; string begin = Transcribe.printTimeWithComma( seg.time.begin ); string end = Transcribe.printTimeWithComma( seg.time.end ); stream.WriteLine( "{0} --> {1}", begin, end ); stream.WriteLine( seg.text ); stream.WriteLine(); } } static void writeWebVTT( Context context, s...
fim
Const-me/Whisper
csharp
<|fim_prefix|>#include "stdafx.h" #include "AppState.h" #include "Utils/miscUtils.h" #include <commctrl.h> #pragma comment(lib, "Comctl32.lib") #include "CircleIndicator.h" namespace { static const HKEY regKeyRoot = HKEY_CURRENT_USER; const LPCTSTR regKey = LR"(SOFTWARE\const.me\WhisperDesktop)"; const LPCTSTR regV...
fim
Const-me/Whisper
cpp
#pragma once #include "Utils/DebugConsole.h" class AppState { bool coInit = false; CRegKey registryKey; CIcon appIcon; public: struct ModelSource { CString path; bool found = false; Whisper::eModelImplementation impl = (Whisper::eModelImplementation)0; uint64_t sizeInBytes = 0; }; ModelSource source; ...
fim
Const-me/Whisper
c
<|fim_prefix|>#pragma once #include "AppState.h" #include "Utils/WTL/atlddx.h" #include "Utils/miscUtils.h" #include "Utils/LanguageDropdown.h" #include "Utils/TranslateCheckbox.h" #include "Utils/PendingState.h" #include "CircleIndicator.h" class CaptureDlg : public CDialogImpl<CaptureDlg>, public CWinDataExchange<...
fim
Const-me/Whisper
c
#include "stdafx.h" #include "CircleIndicator.h" #include <atltypes.h> #include "AppState.h" namespace { static const LPCTSTR windowClassName = L"CircleIndicator"; // Font with these symbols, shipped with Windows since forever: // https://learn.microsoft.com/en-us/typography/font-list/segoe-ui-symbol static cons...
fim
Const-me/Whisper
cpp
<|fim_prefix|>#pragma once #include "Utils/miscUtils.h" #include "Utils/WTL/atlcrack.h" // This control renders a black circle, and in the active state, the circle is filled with a bright color. class CircleIndicator: public CWindowImpl<Circle<|fim_suffix|>lor = col; } CircleIndicator(); private: bool isActive = f...
fim
Const-me/Whisper
c
<|fim_suffix|>d* pv ) noexcept { LoadModelDlg& dialog = *(LoadModelDlg*)pv; constexpr double mul = progressMaxInteger; int pos = lround( mul * val ); dialog.progressBar.PostMessage( PBM_SETPOS, pos, 0 ); return S_OK; } LRESULT LoadModelDlg::OnCallbackStatus( UINT, WPARAM wParam, LPARAM, BOOL& bHandled ) { setPen...
fim
Const-me/Whisper
cpp
<|fim_suffix|>Handled ); LRESULT OnOk( UINT, INT, HWND, BOOL& bHandled ); ConsoleCheckbox cbConsole; CComboBox cbModelType; CEdit modelPath; CProgressBarCtrl progressBar; LRESULT validationError( LPCTSTR message ); LRESULT validationError( LPCTSTR message, HRESULT hr ); ThreadPoolWork work; CString path; W...
fim
Const-me/Whisper
c
<|fim_suffix|>bAdapter = GetDlgItem( IDC_GPU ); const uint32_t flags = appState.gpuFlagsLoad(); // Setup the "Compute shaders" combobox cbWave.AddString( L"Wave64 shaders on AMD" ); cbWave.AddString( L"Wave32, always" ); cbWave.AddString( L"Wave64, always" ); int i = 0; if( 0 != ( flags & (uint32_t)eGpuModelFla...
fim
Const-me/Whisper
cpp
<|fim_prefix|>#pragma once #include "AppState.h" #include "Utils/WTL/atlddx.h" #include "Utils/miscUtils.h" class ModelAdvancedDlg : public CDialogImpl<ModelAdvancedDlg> { CComboBox cbWave, cbReshapedMatMul, cbAdapter; AppState& appState; public: static constexpr UINT IDD = IDD_MODEL_ADV; ModelAdvancedDlg( AppS...
fim
Const-me/Whisper
c
<|fim_suffix|>_APS_NEXT_RESOURCE_VALUE 131 #define _APS_NEXT_COMMAND_VALUE 32771 #define _APS_NEXT_CONTROL_VALUE 1030 #define _APS_NEXT_SYMED_VALUE 110 #endif #endif <|fim_prefix|>//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by WhisperDesktop.rc // #defi...
fim
Const-me/Whisper
c
<|fim_suffix|>g namespace Whisper; CHECK( writeUtf8Bom( file ) ); CStringA line; for( size_t i = 0; i < length; i++ ) { const sSegment& seg = segments[ i ]; if( timestamps ) { line = "["; printTime( line, seg.time.begin ); line += " --> "; printTime( line, seg.time.end ); line += "] "; } ...
fim
Const-me/Whisper
cpp
<|fim_suffix|>id onClose() { ATLVERIFY( EndDialog( IDCANCEL ) ); } void onBack() { ATLVERIFY( EndDialog( IDC_BACK ) ); } void printModelDescription(); CStatic modelDesc; ConsoleCheckbox cbConsole; LanguageDropdown languageSelector; TranslateCheckbox cbTranslate; CEdit sourceMediaPath; CButton useInpu...
fim
Const-me/Whisper
c
// https://github.com/Const-me/vis_avs_dx/blob/master/avs_dx/DxVisuals/Interop/ConsoleLogger.cpp #include "stdafx.h" #include "DebugConsole.h" #include "miscUtils.h" #include "../AppState.h" #include "logger.h" #include <string> namespace { using Whisper::eLogLevel; constexpr uint16_t defaultAttributes = FOREGROUND...
fim
Const-me/Whisper
cpp
<|fim_suffix|>onsoleCheckbox() { if( nullptr != console ) console->removeCheckbox( control ); } void ensureChecked(); };<|fim_prefix|>#pragma once #include <whisperWindows.h> #include <deque> #include <unordered_set> class AppState; class DebugConsole { using eLogLevel = Whisper::eLogLevel; struct Entry { ...
fim
Const-me/Whisper
c
<|fim_suffix|> return UINT_MAX; return keys[ cs ]; } void LanguageDropdown::saveSelection( AppState& state ) { state.languageWrite( selectedLanguage() ); }<|fim_prefix|>#include "stdafx.h" #include "LanguageDropdown.h" #include "miscUtils.h" namespace { inline wchar_t toUpper( wchar_t c ) { size_t st = (uint16_...
fim
Const-me/Whisper
cpp
<|fim_prefix|>#pragma once #include "../AppState.h" // Dropdown list which implements language selector control class Lan<|fim_suffix|>ND m_hWnd = nullptr; std::vector<uint32_t> keys; int getInitialSelection( AppState& state ) const; public: operator HWND() const { return m_hWnd; } // Query language list for...
fim
Const-me/Whisper
c
<|fim_suffix|>true; EnableWindow( editorsWindows[ i ], FALSE ); } else wasEnabled[ i ] = false; } } else { for( size_t i = 0; i < editorsWindows.size(); i++ ) { if( !wasEnabled[ i ] ) continue; EnableWindow( editorsWindows[ i ], TRUE ); } } const int show = nowPending ? SW_NORMAL :...
fim
Const-me/Whisper
cpp
#pragma once // Utility class to switch visual state of dialog controls between idle and pending class PendingState { std::vector<HWND> editorsWindows; std::vector<bool> wasEnabled; std::vector<HWND> pendingWindows; public: void initialize( std::initializer_list<HWND> editors, std::initializer_list<HWND> pending )...
fim
Const-me/Whisper
c