Skip to content

Instantly share code, notes, and snippets.

View bjartwolf's full-sized avatar

Bjørn Einar Bjartnes bjartwolf

View GitHub Profile
@bjartwolf
bjartwolf / edmx.cs
Created March 21, 2024 08:46
edmx builder
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using Microsoft.AspNet.OData.Builder;
using Microsoft.OData.Edm.Csdl;
using Microsoft.OData.Edm.Validation;
@bjartwolf
bjartwolf / reading_list.md
Last active November 22, 2021 19:45
THE COMMANDANT'S PROFESSIONAL READING LIST

This is my recommended reading list. My recommendations are just that, I am not a commandant. It is only based on books I have read, so obviously biased and quite limited. I have named it based on one of the books in my reading list. Parts are .NET centered because that is mostly what I know. A lot is focused on the web. This is not a generic reading list for any software developer, I am mostly focused on web and API focused work stuff in .NET and so is this list. It leans towards the software developer wanting to be a tech-lead, architect or CTO.

A lot of links goes to Amazon, because I have those books in kindle for the most part and it is easy for me, but get them from anywhere.

THE COMMANDANT'S PROFESSIONAL READING LIST

If USMC Grunts can read five books a year, then so can software developers. https://www.marines.mil/News/Marines-TV/videoid/747008/

open BenchmarkDotNet.Attributes
open BenchmarkDotNet.Running
open FSharp.Control.Tasks.V2
open System.Threading.Tasks
open System.Net.Http
open System.Net
open System
type Benchmarks() =
public async Task<int> mywebcontroller (int input) {
if (input == 2) {
return 4;
} else {
await Task.Delay(1000);
return 3;
}
}
async void Main()
let mywebcontroller (input: int) = async {
if (input = 2) then
return 4
else
do! Async.Sleep(1000)
return 3
}
Async.RunSynchronously (mywebcontroller 2) |> printfn "%A"
Async.RunSynchronously (mywebcontroller 1) |> printfn "%A"
@bjartwolf
bjartwolf / gist:b4d9af07396fcc8b34144ebb6c9769b9
Last active November 7, 2019 14:16
"What I talk to new developers about when I get sixty minutes with them"
Alternative titles:
- The introduction new developers in NRK TV and NRK Radio gets to our architecture. And how we work with it.
- The mandatory meeting with the architect at NRK TV/Radio.
NRK - Norwegian Broadcasting Corporation - is the public service broadcaster in Norway. I work as an architect with our streaming services
NRK TV and NRK Radio. This talk is the same presentation that I give new hires in our teams. It is as honest as architecture presentations
goes, if I bullshit in this talk it is at least the same bullshit I serve my colleagues.
Usually people will have had a few weeks in our company already, had their laptop set up and propably deployed some code to
production before we sit down and talk about architecture. The audience of this talk will not have that introduction, but our
@bjartwolf
bjartwolf / clip.cs
Last active February 6, 2019 12:46
public string Description { get; set; }
public string Category { get; set; }
public OnDemandUsageRights UsageRights { get; set; }
public bool IsLive { get; set; }
public string HlsMediaUrl { get; set; }
public string FlashMediaUrl { get; set; }
public MediaType MediaType { get; set; }
public ClipScoreStreaming ScoresStreaming { get; set; }
public MediaAssetsOnDemand MediaAssetsOnDemand { get; set; }
public TimeSpan Duration { get; set; }
{"v":"5.3.4","fr":60,"ip":0,"op":164,"w":1920,"h":1080,"nm":"NRK-reaksjon-wireframe-5","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"stor 2","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":60,"s":[0],"e":[100]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":62,"s":[100],"e":[100]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":66,"s":[100],"e":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":68,"s":[0],"e":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":74,"s":[0],"e":[100]},{"t":78}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"s":true,"x":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":60,"s":[745.955],"e":[1199.955]},{"t":68,"s":[1199.955],"h":1},{"i":{"x":
type OpenInterval = {Start: int; End: int }
let sorted = [{Start = 10; End = 19};
{Start = 11; End = 19};
{Start = 0; End = 8}] |> Seq.sortBy (fun f -> f.Start)
let stack = new Stack<OpenInterval>()
stack.Push (Seq.head sorted)
for interval in Seq.tail sorted do
// http://www.cdn.geeksforgeeks.org/merging-intervals/
type OpenInterval = {Start: int; End: int }
let test = [{Start = 10; End = 19};
{Start = 11; End = 19};
{Start = 0; End = 8}]
// Assumes sorted intervals...
let overLap i i' = i.End + 1 >= i'.Start