brew tap tonidy/tools-tap
brew install mkpasswd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION JSON_UNIQ(arr JSON) RETURNS json | |
BEGIN | |
SET @arr = arr; | |
SET @a_length = JSON_LENGTH(@arr); | |
SET @loop_index = @a_length; | |
WHILE @loop_index >= 0 DO | |
SET @item = JSON_UNQUOTE(JSON_EXTRACT(@arr, concat('$[',@loop_index,']'))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"info": { | |
"version": "1.0.0", | |
"title": "Companies House Public Data API", | |
"description": "An API suite providing read only access to search and retrieve public company data" | |
}, | |
"host": "api.company-information.service.gov.uk", | |
"schemes": [ | |
"https", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mock<IConfiguration> configuration = new Mock<IConfiguration>(); | |
configuration.Setup(c => c.GetSection(It.IsAny<String>())).Returns(new Mock<IConfigurationSection>().Object); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
namespace Extensions | |
{ | |
public static class EnumerablePaginationExtensions | |
{ | |
public static IEnumerable<IEnumerable<T>> Paginate<T>(this IEnumerable<T> items, int pageSize) | |
{ | |
var page = new List<T>(); | |
foreach (var item in items) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@page | |
@{ | |
Layout = ""; | |
} | |
@using System.Linq; | |
@using System.Collections; | |
@using System.Reflection; | |
<html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Using: | |
## to see newconfig | |
## make view newconfig=~/new-config.yaml | |
## to merge configs | |
## make merge newconfig=~/new-config.yaml | |
view:: | |
cp ~/.kube/config ~/.kube/config.bak && KUBECONFIG=~/.kube/config:$(newconfig) kubectl config view --flatten > /tmp/config && cat /tmp/config | |
merge:: | |
cp ~/.kube/config ~/.kube/config.bak && KUBECONFIG=~/.kube/config:$(newconfig) kubectl config view --flatten > /tmp/config && mv /tmp/config ~/.kube/config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
set -eo pipefail | |
# | |
# Part of an introductory Fedora CoreOS blog post on my website: | |
# https://www.matthiaspreu.com/posts/fedora-coreos-first-steps/ | |
# | |
# Script sets up a FCOS virtual machine using QEMU. | |
# | |
# Initial user "matthias" with password "test" can be used. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# NB: When editing this file, be careful to preserve the original whitespace (especially newlines). | |
HDXRTME_install_loadstrings_en() | |
{ | |
HDXRTME_install_yeschoices="yes,YES,Yes,y,Y" | |
HDXRTME_install_nochoices="no,NO,No,n,N, " # <-- trailing comma+space indicates empty input defaults to N |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//taken from https://blogs.msmvps.com/kenlin/2018/01/18/2694/ | |
protected void Application_BeginRequest(object sender, EventArgs e) | |
{ | |
if (HttpContext.Current.Request.HttpMethod == "OPTIONS") | |
{ | |
//These headers are handling the "pre-flight" OPTIONS call sent by the browser | |
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE"); | |
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept"); | |
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Credentials", "true"); | |
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000"); |