View notes.md

Some random tests of certbot (0.22) behaviour, as part of an effort to script its usage.

Setup:

  • *.wildcard.example.org DNS points at this server, so HTTP-01 auth works.
  • CERTBOT_PARAMS=" --test-cert --email me@example.org --agree-tos --webroot --webroot-path /var/www/html --non-interactive"

Add a domain, without --expand

certbot certonly $CERTBOT_PARAMS --domains test1.wildcard.example.org
View windows-secrets.md

This is just random things I've come across that are not well known, but useful, and I'd like to remember.

Shout outs to https://twitter.com/SwiftOnSecurity where I probably found most/all of these.

  • psr.exe - Screen steps recorder
  • Win+Shift+S - Snipping tool
  • Reliablity Monitor - Fast troubleshooting tool
  • |clip - Pipe output of commands to clipboard
View FriendlyPasswordGenerator.cs
using System;
using System.Globalization;
using System.Security.Cryptography;
/// <summary>
/// Generates human-friendly and easily remembered passwords such as "RelevantLecture!217"
/// or "AirlineCoffee$538".
///
/// Existing word set generates nearly 1.3 billion possible passwords.
/// </summary>
View CopyPaste.ps1
# Powershell script
$nic=gwmi -computer . -class "win32_networkadapterconfiguration"|Where-Object{$_.defaultIPGateway -ne $null}
$IP=$nic.ipaddress|select-object -first 1;$Mask=$nic.ipsubnet|select-object -first 1;$IPInt=([Net.IPAddress]$IP).Address;$MaskInt=([Net.IPAddress]$Mask).Address;$start=($IPInt -band $MaskInt);$end=($IPInt -bor(-bnot [uint32]$MaskInt))-16777216;
Write-Host "Scanning $IP/$Mask...";while($start -lt $end){$start += 16777216;Test-Connection (new-object System.Net.IPAddress $start).ToString() -Count 1 -AsJob|Out-Null};Start-Sleep 1;
Write-Host "Looking up hostnames..";Get-NetNeighbor|Where-Object{$_.LinkLayerAddress.StartsWith("B8-27-EB")}|ForEacH { [PSCustomObject]@{IP = $_.IPAddress; MAC = $_.LinkLayerAddress; Host = [System.Net.Dns]::GetHostByAddress($_.IPAddress).HostName}}
View uninstall-mssql.ps1
# Powershell script to uninstall all Microsoft SQL Server stuff.
# There's so many entries it's a pain to uninstall everything manually. Run via PowerShell (or PowerShell ISE) as Admin.
# Warning: this still prompts for confirmation on a bunch of items.
$uninstall32 = gci "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | foreach { gp $_.PSPath } | ? { $_ -match "SQL Server" } | select DisplayName,UninstallString
$uninstall64 = gci "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | foreach { gp $_.PSPath } | ? { $_ -match "SQL Server" } | select DisplayName,UninstallString
$uninstall = $uninstall32 + $uninstall64 | where {$_.UninstallString -match "MsiExec"} | Sort DisplayName
View gist:43124c78a8a5c4866bbd0ccf9821fe77
### Keybase proof
I hereby claim:
* I am gregmac on github.
* I am gregmac (https://keybase.io/gregmac) on keybase.
* I have a public key ASBOl8fdnaaIZeRYR8GqeKB2oBereEq6at1bjvcDvYHzVwo
To claim this, I am signing this object:
View reclaimWindows10.ps1
##########
# Run as admin:
#
# (New-Object System.Net.WebClient).DownloadString("https://gist.github.com/gregmac/c8cf9fe7e48d0e9a15c985674b9861d9/raw") | iex
#
# Tweaked Win10 Initial Setup Script
# Primary Author: Disassembler <disassembler@dasm.cz>
# Modified by: alirobe <alirobe@alirobe.com> based on my personal preferences.
View NullCheckExtensions.cs
public static class NullCheckExtensions
{
public static bool IsNullOrEmpty(this string value) => string.IsNullOrEmpty(value);
public static bool IsNullOrWhitespace(this string value) => string.IsNullOrWhiteSpace(value);
public static bool IfNotNull<T>(this T value, Action<T> trueAction)
{
if (value == null) return false;
View usermacro.html
## Macro title: UML Sequence Diagram
## Macro has a body: Y
## Body processing: Unrendered
##
## This macro allows use of js-sequence-diagrams from http://bramp.github.io/js-sequence-diagrams/
##
## Developed by: Greg MacLellan
## Date created: 2015-09-15
## 2015-09-21: Added suppor for displaying parse errors while rendering
## Installed by: Greg MacLellan
View gist:977437ce7fd49d7a0475

For my own reference, settings that are necessary to make Windows 8/8.1 nice.

Start menu

StartIsBack or Start8. Either work, and this is absolutely essential.

Disable forced auto-update

This inevitably happens during something important. Glad to see MS forces updates -- but... I will restart when I restart.