This file contains 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
# Выгружает в формате csv без вставки в заголовок файла описание типа, в кодировке Юникод. | |
export-csv -Path C:\temp\export.csv -Delimiter ';' -NoTypeInformation -Encoding Unicode |
This file contains 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
$webclient = New-Object System.Net.WebClient | |
$creds = Get-Credential | |
$webclient.Proxy.Credentials = $creds | |
Update-Help -Credential $creds |
This file contains 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 "System.DirectoryServices.AccountManagement.dll" | |
open System.DirectoryServices.AccountManagement | |
let testSearch fullName = | |
let ctx = new PrincipalContext(ContextType.Domain) | |
let u = new UserPrincipal(ctx) | |
u.Surname <- fullName | |
use ps = new PrincipalSearcher(u) | |
ps.FindAll() | |
|> Seq.cast<System.DirectoryServices.AccountManagement.UserPrincipal> |
This file contains 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
(** # Примеры использования FSharp.Text.RegexProvider*) | |
(** ## Проверка ссылок на F#*) | |
(** Следующий скрипт выводит информацию о ссылках в html-коде, хранящемся в переменной html. | |
Скрипт портирован из примера в книге Д. Фридл, Регулярные выражения стр. 257 *) | |
open System.Text.RegularExpressions | |
open FSharp.Text.RegexProvider | |
[<Literal>] | |
let aTagPattern = |
This file contains 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.Diagnostics | |
let sizeEventLog (el : EventLog) = | |
Microsoft.Win32.Registry.LocalMachine.OpenSubKey( @"System\CurrentControlSet\Services\EventLog\" + el.Log ) | |
|> Option.ofNull | |
|> Option.bind ( fun registryKey -> registryKey.GetValue("FIle") |> Some ) | |
|> Option.bind Option.ofNull | |
|> Option.bind ( fun x -> x.ToString() |> Some ) | |
|> Option.bind ( fun filePath -> new FileInfo(filePath) |> Some ) | |
|> Option.bind ( fun fi -> fi.Name |> Some ) |
This file contains 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
let ``Next N Friday 13`` n = | |
Seq.initInfinite (fun i -> i |> float |> System.DateTime.Now.AddDays) | |
|> Seq.filter (fun date -> date.Day = 13 && date.DayOfWeek = System.DayOfWeek.Friday) | |
|> Seq.map (fun date -> date.ToShortDateString()) | |
|> Seq.take n | |
|> Seq.toList | |
// Output: | |
// val ( Next N Friday 13 ) : n:int -> string list | |
// val it : string list = |
NewerOlder