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
/// <summary>Extended alternatives for <c>string.</c> methods</summary> | |
// ReSharper disable once InconsistentNaming | |
public static class strings | |
{ | |
/// <summary>Joins the non-null items of <paramref name="values"/>, putting <paramref name="separator"/> | |
/// between each item.</summary> | |
/// <param name="separator">Separator is only used if <paramref name="values"/> has at least | |
/// 2 non-null elements.</param> | |
/// <param name="values">The values to join.</param> | |
/// <typeparam name="T"></typeparam> |
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
#! /usr/bin/env pwsh | |
Param( | |
[string]$installerName="Installer", | |
[Parameter(Mandatory=$true)][string]$installerPassword, | |
[Parameter(Mandatory=$true)][ValidateScript( | |
{try{[System.Net.Mail.MailAddress]$_;return $true;}catch{return $false}})] | |
[string]$installerEmail, | |
[string]$dbServer=$env:SQLCMDSERVER, | |
[string]$dbDatabaseName="Umbraco", |
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
#! /usr/bin/env pwsh | |
<# | |
.SYNOPSIS | |
Create a Postgres application database and roles for owner, application, and application_readonly | |
.DESCRIPTION | |
Create a Postgres application database and create roles for owner, application, and application_readonly. | |
- the owner role has no login. the user that runs this script will be assigned to that role |
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
#! /usr/bin/env python3 | |
# Taken from https://blog.crunchydata.com/blog/how-to-upgrade-postgresql-passwords-to-scram | |
help= \ | |
""" | |
Generate scram-sha-256 password hashes / verifiers for PostgreSQL 10+ | |
Usage: | |
scram_postgres_password Username1 Password1 [, ... UsernameN PasswordN ] |
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 | |
kextoffdir="/kextoff" | |
loginhookscript="/Library/LoginHook/LoadDelayedAMDRadeonX3000kext.sh" | |
echo "--------------------------------------------------------------- | |
Run this script twice. | |
First, from a Recovery Mode commandline to run csrutil disable. | |
Second, after rebooting to a Single user mode commandline, with / partition mounted writeable, to do all the things that must be done with csrutil status= disabled |
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Web; | |
using System.Web.Mvc; | |
namespace Helpers | |
{ | |
/// <summary>Create or Render a <see cref="Helpers.PartialSection"/>s via the current <see cref="HtmlHelper"/></summary> |
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; | |
using System.Reflection; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Serialization; | |
public class DeSerializeExcludingFieldsContractResolver : DefaultContractResolver | |
{ | |
readonly Type type; | |
readonly Predicate<JsonProperty> ignoreProperty; |
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
public abstract class WebClientBase : IDisposable | |
{ | |
WebHeaderCollection headers = new WebHeaderCollection(); | |
public abstract void UploadValuesAsync(Uri address, string method, NameValueCollection data); | |
public abstract void UploadValuesAsync(Uri address, string method, NameValueCollection data, object userToken); | |
public abstract byte[] UploadData(Uri address, string method, byte[] data); | |
public abstract byte[] UploadFile(Uri address, string method, string fileName); | |
public abstract byte[] UploadValues(Uri address, string method, NameValueCollection data); |
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
public static class StringExtensions | |
{ | |
/// <summary> | |
/// Overwrite the right-most fraction 1/<paramref name="maskFractionOneOver"/> of <paramref name="str"/> with <paramref name="maskCharacter"/> | |
/// </summary> | |
/// <param name="str"></param> | |
/// <param name="maskFractionOneOver"></param> | |
/// <param name="maskCharacter"></param> | |
/// <example>"1234".Masked() => "123*"</example> | |
/// <returns>the masked string</returns> |
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
<# | |
.SYNOPSIS | |
Uninstall one or more Windows Program or Feature, by name or regular expression. | |
.DESCRIPTION | |
Lists Programs And Features installed on the current machine which match | |
the -matchingName parameter and then, after force or confirmation, uninstalls them. | |
Examples |