Skip to content

Instantly share code, notes, and snippets.

View EtherZa's full-sized avatar

Richard Pringle EtherZa

  • Perth, Australia
View GitHub Profile
@EtherZa
EtherZa / git-redact-filter.sh
Last active December 15, 2023 14:25
git filter to smudge/clean secrets stored in .ini
#!/bin/bash
# README
# Swap secrets for placeholders on commit/restore
#
# Copy this file to ~/scipts/git-redact-filter.sh
# chmod +x ~/scripts/git-redact-filter.sh
#
# Create ~/scripts/secret.ini
# populate with key=value
@EtherZa
EtherZa / git-commit-comments
Created June 20, 2023 13:29 — forked from jeff1evesque/git-commit-comments
Change git comment character from '#' to ';'
git config core.commentChar ';'
@EtherZa
EtherZa / oracle_delete_all_objects.sql
Created October 11, 2019 03:52
Delete all objects in an Oracle schema
-- Maximum carnage. Delete everything in a schema
declare
V_SCHEMA varchar(100);
begin
V_SCHEMA := 'APSM';
-- drop queues
for R_QUEUE in (
select V_SCHEMA || '.' || NAME as QUEUE_NAME
from SYS.ALL_QUEUES
@EtherZa
EtherZa / pre-commit
Created August 12, 2019 02:53
Format c# with dotnet-format with pre-commit hook
#!/bin/sh
#
# modified from sample: https://prettier.io/docs/en/precommit.html
#
# install dotnet-format: dotnet tool install -g dotnet-format
# copy to .git/hooks/pre-commit and make executable
#
FILES=$(git diff --cached --name-only --diff-filter=ACM "*.cs" | sed 's| |\\ |g')
@EtherZa
EtherZa / buildNumber.ps1
Last active June 18, 2019 06:01
Creates a build number from the current date, build counter and branch name where branch name starts with a story name/number prefix.
# Generated a build number in the format year.month.day.buildCounter-story
# where story is derived from the branch name
#
# Parameters are expected in the following order:
# 1. build counter
# 2. branch name in the format develop | XXXX-ddd
param (
[parameter(Mandatory=$true)] [int]$buildCounter,
[parameter(Mandatory=$true)] [string]$branch
@EtherZa
EtherZa / RetargetFramework.cs
Last active July 5, 2021 09:14
Visual Commander script to retarget all loaded Visual Studio projects to a specified .net version (TargetFramework).
// Retarget all loaded projects to the .net version specified in "TargetFramework"
// Execute with Visual Commander (https://marketplace.visualstudio.com/items?itemName=SergeyVlasov.VisualCommander)
// **********************************************************
// NOTE: NuGet packages need to be reinstalled post execution
// **********************************************************
using EnvDTE;
using EnvDTE80;
using System.Collections.Generic;
@EtherZa
EtherZa / ListboxScroll.xaml
Created January 22, 2019 00:40
[WPF] ListBox blocks mouse scrolling
<ListBox>
<ListBox.Template>
<ControlTemplate>
<!-- Empty template to allow ScrollViewer to capture mouse scroll -->
<ItemsPresenter />
</ControlTemplate>
</ListBox.Template>
</ListBox>
@EtherZa
EtherZa / ReplaceTokens.ps1
Last active November 6, 2017 06:52
Replace tokens in config transformations. Used for prepping branched deployments.
# Submit with a single parameter of a comma delimted list of key=value pairs.
# Caveat: no escaping is performed, so the script will go awry if the value contains a ',' and the script is not modified
param (
[parameter(Mandatory=$true)] [string]$raw
)
$filter = '*.setParameters.xml'
$lookup = ConvertFrom-StringData ($raw.split(",") | out-string)
@EtherZa
EtherZa / SyncWeb.ps1
Created November 6, 2017 06:45
Synchronise IIS hosted website across multiple servers via web deploy. Console output for TeamCity support.
# Parameters are expected in the following order:
# 1. Path to ms deploy eg. "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
# 2. Source server name eg. server1.domain.net
# 3. Path to setParameters.xml which contains 'IIS Web Application Name' override [Comma delimitted]
# 4. User name eg. domain\username
# 5. Password eg. ****** (Caveat: not escaped)
# 6. Destination server name(s) [Comma delimitted] eg. server2.domain.net,server3.domain.net
param (
[parameter(Mandatory=$true)] [string]$msdeploy,
@EtherZa
EtherZa / ShowConsole.cs
Created July 7, 2017 14:25
Output to console in Windows Forms application
namespace ShowConsole
{
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public static class Program
{
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]