Skip to content

Instantly share code, notes, and snippets.

View Boggin's full-sized avatar
💭
bleep bloop blorp

Richard Bogle Boggin

💭
bleep bloop blorp
View GitHub Profile
@Boggin
Boggin / Get-ArchiveSize.ps1
Created March 9, 2021 17:11
Get the monthly average folder size
<#
Given the list of folders and the dates over which to check then this script
will group the files by month for each folder between the given dates and get
the sum of the file sizes. So you will get a calculated property of 'folder',
'month', 'size' (where file size is in MB to two decimal places). Then that
calculated property is grouped by 'folder' and the cumulative file size over the
selected months is averaged. So you will have a calculated property of 'folder',
'monthly' (where 'monthly' is a monthly average in MB).
#>
$archives = @{
@Boggin
Boggin / BitLockerSmartCardYubiKey.md
Created January 17, 2021 10:53
Use YubiKey Smart Card for BitLocker on W10

Use YubiKey Smart Card for BitLocker on W10

Create certificate

The certificate will be an Encrypting File System (EFS) self-signed smart card certificate.

  • Control Panel > User Accounts > Manage your file encryption certificates
    Create new and store locally

YubiKey Manager

@Boggin
Boggin / keyboard.ahk
Last active May 7, 2020 20:37
Colemak Mod-DH Angle Extend AutoHotkey layout
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; Colemak Mod-DH angle wide mapping for ANSI boards
SC029::Esc
;SC002::1
;SC003::2
@Boggin
Boggin / git-filter-repo.md
Last active September 28, 2022 14:43
Using git-filter-repo to rewrite history and remove secrets

Removing Secrets In Your Git Repository

If you have a code-base under source control that is internal to your company, for instance, it's hosted on premises, you may have checked in some secrets in your configuration files. We all know we should have had those encrypted or kept outside of the checked-in source in some way but perhaps it was just better to accrue some technical debt and worry about it later. Okay, now it's later.

git-filter-repo

@Boggin
Boggin / gist:5649e5873c076060678817eab826d38b
Last active May 10, 2022 13:46
Use Restic to perform backups to Backblaze B2.
We couldn’t find that file to show.
@Boggin
Boggin / keymap.reg
Created June 19, 2019 09:38
Registry edit for keymapping
Windows Registry Editor Version 5.00
; The hex data is in five groups of four bytes:
; 00,00,00,00,\ header version (always 00000000)
; 00,00,00,00,\ header flags (always 00000000)
; 02,00,00,00,\ # of entries (1 in this case) plus a NULL terminator line.
; Entries are in 2-byte pairs: Key code to send & keyboard key to send it.
; Each entry is in LSB, MSB order.
; 01,00,3a,00,\ Send ESC (0x0001) code when user presses the CAPS LOCK key (0x003a)
; 00,00,00,00 NULL terminator
Import-Module SqlServer
$srv = New-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = $srv.Databases.Item("IntermediaryManagement.DB")
$scrp = New-Object Microsoft.SqlServer.Management.Smo.Scripter($srv)
$scrp.Options.ScriptData = $TRUE
$scrp.Options.ScriptSchema = $FALSE
$tbl = $db.tables | Where-Object { $_.IsSystemObject -eq $FALSE }
$scrp.EnumScript(@($tbl)) | %{ Add-Content temp.sql $_ }
@Boggin
Boggin / SqlExceptionMocker.cs
Last active November 9, 2018 17:46 — forked from martinjw/SqlExceptionMocker.cs
Create a SqlException for testing
// .csproj
// <PackageReference Include="System.Data.SqlClient" Version="4.3.0" />
// <PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0" />
namespace HorribleThingsInHere
{
using System.Data.SqlClient;
using System.Linq;
using System.Reflection;
public struct Option<T>
{
private readonly T _value;
public T Value
{
get
{
if (!HasValue)
throw new InvalidOperationException();
Install-Module Pscx
Install-Module posh-git
Install-Module PSReadLine
Install-Module PSake
Install-Module Pester