Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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
@toburger
toburger / C++ and Qt.md
Last active May 5, 2019 21:40
information and ideas...

C++ and Qt

General advice

  • [C++] prefer expressions over statements
  • [C++] prefer immutability over mutability
  • [C++] prefer composition over inheritance
  • [Qt] prefer STL over QTL containers

Libraries

@toburger
toburger / prompt.ps1
Last active March 16, 2019 11:16 — forked from kadet1090/prompt.ps1
PowerLine like prompt for PowerShell
$script:bg = [Console]::BackgroundColor;
$script:first = $true;
$script:last = 0;
function Write-PromptFancyEnd {
Write-Host  -NoNewline -ForegroundColor $script:bg
$script:bg = [System.ConsoleColor]::Black
}
@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 / build.fsx
Last active May 15, 2017 08:36
Use fsc 4.x to compile your code
//...
let fscToolPath = findToolFolderInSubPath "fsc.exe" "packages"
let msbuildProps = [ "FscToolPath", fscToolPath ]
Target "Build" (fun _ ->
!! projectFile
|> MSBuildReleaseExt releaseDir msbuildProps "Build"
|> Log "AppBuild-Output")
@toburger
toburger / keyboard_speed_settings.reg
Created March 27, 2017 07:58
Keyboard speed settings
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response]
"AutoRepeatDelay"="250"
"AutoRepeatRate"="13"
"BounceTime"="0"
"DelayBeforeAcceptance"="0"
"Flags"="59"
"Last BounceKey Setting"=dword:00000000
"Last Valid Delay"=dword:00000000