Skip to content

Instantly share code, notes, and snippets.

View AndreSteenveld's full-sized avatar

Andre Steenveld AndreSteenveld

View GitHub Profile
@AndreSteenveld
AndreSteenveld / OptionJsonConverter.cs
Created July 16, 2021 07:42 — forked from gmanny/OptionJsonConverter.cs
JsonConverter for LanguageExt.Option which serializes empty Options as nulls.
using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Reflection;
using LanguageExt;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
public class OptionJsonConverter : JsonConverter
{
@AndreSteenveld
AndreSteenveld / table-to-tsv.sh
Created November 4, 2021 14:46
Using bcp to dump table to csv
#! /usr/bin/env bash
set -e
#
# Invoke this script; table-to-tsv <database> <schema> <table> -U sa -P 'P455word!!!' -S localhost
#
# The output will be written to stdout, redirecting to where you need your tsv to go. Make sure `bcp`
# is in your path, in the docker images it can be found in /opt/mssql-tools/bin
#
@AndreSteenveld
AndreSteenveld / dump-to-csv
Last active November 24, 2021 08:46
Dumping table from SQL server to SQLite
#! /usr/bin/env bash
set -e
#
# Invoke this script; dump-to-csv <database> <schema> <table> -U sa -P 'P455word!!!' -S localhost
#
# The output will be written to stdout, redirecting to where you need your csv to go. Make sure `bcp`
# is in your path, in the docker images it can be found in /opt/mssql-tools/bin
#
@AndreSteenveld
AndreSteenveld / wait-for-sql-server
Last active November 15, 2021 12:53
Bash script that waits for SQL server to accept logins
#! /usr/bin/env bash
wfss__help() {
printf '%s\n'\
'wait-for-sql-server - Tries to connect to sql server otherwise fails ' \
' ' \
'Usage: ' \
' wait-for-sql-server [options] -- <sqlcmd options> ' \
' wait-for-sql-server <sqlcmd options> ' \
@AndreSteenveld
AndreSteenveld / TupleAsArray.Test.cs
Created February 2, 2022 04:47
System.Text.Json tuple (de)serializer
// This work is licensed under a Creative Commons Attribution 4.0 International License
// If you find a bug or some issue you can find me (and the orginal of this file) at https://gist.github.com/AndreSteenveld
using System;
using System.Text.Json;
using Json = System.Text.Json;
using Xunit;
using Tuple = System.Tuple;
namespace AndreSteenveld.Test
{
@AndreSteenveld
AndreSteenveld / compose-files
Last active March 21, 2024 05:49
Helper script to gather docker-compose files
#! /usr/bin/env bash
cf__help(){
printf '%s\n' \
'compose-files - Helper script to gather docker-compose files ' \
' ' \
'Usage: ' \
' compose-files [options --] [presets] ' \
' ' \