Skip to content

Instantly share code, notes, and snippets.

@pimbrouwers
pimbrouwers / Invoke-DotnetExe.ps1
Last active December 3, 2022 01:44
Invoke-DotnetExe.ps1
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, HelpMessage = "The path to the project")]
[String]
$Project,
[Parameter(Mandatory = $true, HelpMessage = "The .NET Runtime Identifier")]
[ValidateSet("win-x64")]
[String]
$Rid,
@pimbrouwers
pimbrouwers / sqlite-calendar-table.sql
Last active November 16, 2022 21:46
SQLite Calendar Table
--DROP TABLE IF EXISTS calendar;
--CREATE TABLE calendar AS
WITH RECURSIVE dates_cte (dt) AS (
VALUES('1970-01-01') -- Choose a start date
UNION ALL
SELECT date(dt, '+1 day')
FROM dates_cte
WHERE dt < '2050-12-31' -- Choose an end date
),
calendar_cte AS (
open System
open System.Text
[<AbstractClass; Sealed>]
type StringBuilderCache private () =
// The value 360 was chosen in discussion with performance experts as a compromise between using
// as litle memory (per thread) as possible and still covering a large part of short-lived
// StringBuilder creations on the startup path of VS designers.
[<Literal>]
static let _maxBuilderSize = 360
@pimbrouwers
pimbrouwers / Database.fsx
Created April 25, 2022 15:25
F# Database Abstractions using Donald
open System
open System.Data
open System.Data.Common
open Donald
//
// Logging
type LogError =
{ Error : exn
Message : string }
@pimbrouwers
pimbrouwers / Tipi.fsx
Created March 24, 2022 17:52
F# HTTP Module
module Http =
open System
open System.Net
open System.Net.Http
type RequestFailure =
{ Url : Uri
StatusCode : HttpStatusCode option
Message : string }
@pimbrouwers
pimbrouwers / ubuntu-20_04-web-server-setup-instructions.md
Last active March 21, 2022 15:12
Ubuntu 20.04 Web Server Setup Instructions

Ubuntu 20.04 Web Server Setup Instructions

!!! Work in progress, use at your own risk. !!!

  • nginx
  • certbot
  • iptables

Updates

@pimbrouwers
pimbrouwers / Log.fsx
Last active April 18, 2022 20:48
Simple F# Logging Module
module Log =
open System
open System.IO
let private logDir = "logs"
let private log kind fmt =
Printf.kprintf (fun s ->
let now = DateTime.Now
let msg = sprintf "[%s] [%s] %s" (now.ToString("s")) kind s
@pimbrouwers
pimbrouwers / char-counts.md
Last active February 19, 2024 12:42
Useful character counts to help when deciding field length

8 CHARS

Lorem ip

16 CHARS

Lorem ipsum dolo

<?php
namespace Turnpike;
class Controller
{
protected $viewEngine;
function __construct(PhpViewEngine $viewEngine)
{
@pimbrouwers
pimbrouwers / fn_utc_to_edt.sql
Last active October 29, 2021 14:25
SQL Server Convert UTC to EST/EDT (Eastern Daylight Time)
/*** fn_utc_to_edt ***/
IF NOT EXISTS (SELECT 1
FROM [INFORMATION_SCHEMA].[ROUTINES]
WHERE [ROUTINE_NAME] = 'fn_utc_to_edt'
AND [ROUTINE_TYPE] = 'FUNCTION')
BEGIN
EXEC('CREATE FUNCTION [dbo].[fn_utc_to_edt]() RETURNS INT AS BEGIN RETURN 1 END')
END;
GO