Skip to content

Instantly share code, notes, and snippets.

#nowarn "9"
module private Internals =
open System.Runtime.InteropServices
type CRED_TYPE =
| GENERIC = 1
| DOMAIN_PASSWORD = 2
| DOMAIN_CERTIFICATE = 3
<#
.SYNOPSIS
Gets a PowerShell Credential (PSCredential) from the Windows Credential Manager
.DESCRIPTION
Adapted from: http://stackoverflow.com/questions/7162604/get-cached-credentials-in-powershell-from-windows-7-credential-manager
.PARAMETER TargetName
The name of the target login informations in the Windows Credential Manager
@toburger
toburger / instructions.md
Last active January 21, 2023 10:46
Open Excel on the same virtual Desktop

A very annoying behaviour is that Excel opens an Excel file on the virtual Desktop of an existing Excel Instance and switches to that Desktop.
If you want to avoid this behaviour you can do the following to fix it:

The fix is to call Excel with the /X parameter:

$ assoc .xlsx
.xlsx=Excel.Sheet.12

$ ftype Excel.Sheet.12
@toburger
toburger / idiomaticjsonserialiser.fs
Last active May 9, 2021 00:15 — forked from isaacabraham/idiomaticjsonserialiser.fs
This JSON.Net converter handles F# discriminated unions with more "idiomatic" JSON than what is generated by the current version of JSON .NET. Option types and single case DUs are transparently handled, and tuple-style properties are used rather than array notation.
namespace Newtonsoft.Json.Converters
open Microsoft.FSharp.Reflection
open Newtonsoft.Json
open System
type IdiomaticDuConverter() =
inherit JsonConverter()
[<Literal>]
@toburger
toburger / Readme.md
Last active January 20, 2021 11:47
Convert JSON array to PG array type and use it as generated column.

To convert a JSON array to be used as generated text[] column follow the steps below:

Define the following (immutable) function:

create or replace function json_array_to_pg_array(jsonarray jsonb) returns text[]
	as $$
		begin
			return (select array(select jsonb_array_elements_text(jsonarray)));
 end;
@toburger
toburger / dabblet.css
Created April 4, 2013 09:27 — forked from anonymous/dabblet.css
Simple CSS only flyout menu
/**
* Simple CSS only flyout menu
*/
body {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
font-family: Arial;
}
@toburger
toburger / dabblet.css
Created May 17, 2013 08:18
nice background slideshow with CSS3 transitions
/**
* nice background slideshow with CSS3 transitions
* adapted from: http://tympanus.net/codrops/2012/01/02/fullscreen-background-image-slideshow-with-css3/
*/
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, textarea, p, blockquote, th, td {
margin: 0;
padding: 0;
}
@toburger
toburger / fable-repl.fs
Created February 14, 2020 10:28
Created with Fable REPL
module Recharts
open Fable.Core.JsInterop
open Fable.Recharts
open Fable.Recharts.Props
open Fable.React
open Elmish
open Elmish.React
module R = Fable.React.Standard
module P = Fable.React.Props
@toburger
toburger / fable-repl.fs
Created February 14, 2020 10:21
Created with Fable REPL
module Recharts
open Fable.Core.JsInterop
open Fable.Recharts
open Fable.Recharts.Props
open Fable.React
open Elmish
open Elmish.React
module R = Fable.React.Standard
module P = Fable.React.Props
@toburger
toburger / fable-repl.fs
Created December 2, 2019 14:59
Created with Fable REPL
module private BusinessLogic =
let switchAt pos (str: string) =
let str = Seq.toArray str
let oldpos = (pos + str.Length - 1) % str.Length
let newpos = pos % str.Length
let tmp = str.[newpos]
str.[newpos] <- str.[oldpos]
str.[oldpos] <- tmp