Skip to content

Instantly share code, notes, and snippets.

View wiig-with-a-k's full-sized avatar

Erlend Wiig wiig-with-a-k

View GitHub Profile
@wiig-with-a-k
wiig-with-a-k / TippeKone
Created March 28, 2014 14:15
Short fsharp program to determine the table position for the norwegian Tipeliga based on tips found on the Internet
open System
//kannikskoleavis, TV2, NRK, VG, Aftenposten, Dagbladet
let tips = [|
("Bodø", [|7.0;12.0;11.0;10.0;10.0;13.0|]);
("Brann", [|9.0;7.0;6.0;5.0;5.0;6.0|]);
("Haugesund", [|6.0;5.0;7.0;7.0;6.0;7.0|]);
("Lillestrøm", [|8.0;11.0;12.0;13.0;13.0;9.0|]);
("Molde", [|1.0;2.0;2.0;1.0;3.0;2.0|]);
("Odd", [|13.0;9.0;5.0;6.0;7.0;10.0|]);
("Rosenborg", [|2.0;1.0;1.0;2.0;1.0;1.0|]);
namespace GeOda.PicturesEh
type SnapConfig =
{
programmeId: string
carrierId: string
outputSnapPath: string
outputSnapName: string
outputSnapTime: string
}
Parallel.ForEach(_configuration.StorageVolumes, x =>
{
var listForStorage = paths.Where(p => p.StartsWith(x.BaseLocation)).ToList();
Console.WriteLine(string.Format("Starting volume {0} with {1} folders", x.BaseLocation, listForStorage.Count.ToString()));
var storageErrors = _client.CheckCDNForGuidConsistencyErrors(x, listForStorage);
lock(allErrors)
{
allErrors.AddRange(storageErrors);
}
});
private void CheckFilesInFolder(Sftp connection, string directory, List<string> errors)
{
if (!connection.DirectoryExists(directory))
return;
var items = connection.GetList(directory);
var files = items.Where(x => x.IsFile).ToList();
if (files.Any(f => f.Name.EndsWith(".mp4") || f.Name.EndsWith(".mp3")))
{
private List<string> CheckFilesInFolder(Sftp connection, List<string> paths)
{
var errors = new List<string>();
foreach (var path in paths)
{
if (connection.DirectoryExists(path))
{
var files = connection.GetList(path);
if (files.Any(f => f.Name.EndsWith(".mp4") || f.Name.EndsWith(".mp3")))
open System.IO
open System.Security.Cryptography
type Config =
{ maxFileSize: int64
startPath: string }
type FileResult =
{ hash: string
fullPath: string }
type Input =
| ResultGreat
| ResultNotSoGreat
type ResultImproverAgent (logger) =
let agent = MailboxProcessor.Start(fun inbox ->
let rec messageLoop () = async {
let! msg = inbox.Receive()
match msg with
| ResultGreat -> "Result already great, cannot be improved" |> logger