Skip to content

Instantly share code, notes, and snippets.

aplocher / data-dict-gen.sql
Created Feb 8, 2021
Generate a complete markdown data dictionary template, including a table of contents, for Azure DevOps wiki from a list of tables. Will also display PK and FK info
View data-dict-gen.sql
use my-database
declare @tableList table (Id int not null primary key identity, DatabaseName varchar(50), SchemaName varchar(50), TableName varchar(50), TableDescription varchar(max))
-- Which tables to generate the markdown for?
insert into @tableList (DatabaseName, SchemaName, TableName, TableDescription) values
('my-database', 'dbo', 'Entity', ''),
aplocher / patch3800sw.ps1
Last active May 20, 2021
Patch router firmware files for WNDR3800SW (SureWest specific) router model. Can convert any Netgear WNDR3800 firmware img to work with WNDR3800SW. Requires perl.exe currently.
View patch3800sw.ps1
# Patch firmware .img files used for Netgear WNDR3800 routers to work with Netgear WNDR3800SW
# The SW model routers are specfic to SureWest Communications (ISP from northern CA)
# The routers are identical, but require a different header on the .img file. This should work with any
# .img file that works with a WNDR3800, including DD-WRT, OpenWRT, and the Netgear factory firmware
## Usage: .\patch3800sw <input img file path> <output img file path>
## Example: .\patch3800sw openwrt-ar71xx-generic-wndr3800-squashfs-factory.img openwrt-wndr3800sw.img
aplocher / AnyConnect.ahk
Last active Feb 25, 2021
AutoHotKey script for Cisco AnyConnect. Takes hostname, username, and password as external args. Great for creating multiple shortcuts if you have more than one AnyConnect VPN.
View AnyConnect.ahk
; Create a shortcut to this file in Windows for each AnyConnect VPN configuration you need
; Each shortcut can have a different host, user, and pass defined (3 command line args)
; Usage: AutoHotKey.exe AnyConnect.ahk hostname username password
#SingleInstance force
if 0 < 3 ; The left side of a non-expression if-statement is always the name of a variable.
MsgBox This script requires at least 3 incoming parameters but it only received %0%.
aplocher / FixStoreApps.ps1
Last active Feb 18, 2021
Fix for Remove-AppxPackage error "HRESULT: 0x80073CFA, Removal failed The system cannot find the file specified.". Requires psexec to be installed
View FixStoreApps.ps1
param (
[switch]$Relaunched = $false
$ScriptPath = (Get-Variable MyInvocation).Value.MyCommand.Path
function StartOperation {
Write-Host Now attempting to regenerate missing manifest files...
aplocher / data-dict-gen-simple.sql
Created Feb 8, 2021
T-SQL script to generate data dict. markdown to be used in Azure DevOps Wiki from a SQL Server table
View data-dict-gen-simple.sql
use varis_p
@table varchar(50) = 'dbo.SomeTable'
select md from (
-- Row 1 - Headers
-2 as colid,
View resume.json
"basics": {
"name": "Adam Plocher",
"picture": "",
"label": "Software Developer at Varis LLC",
"headline": "A motivated and professional software engineer with over 15 years of experience in the industry",
"summary": "Experienced full-stack developer with an appreciation for design patterns.",
"website": "",
"yearsOfExperience": 19,
"username": "aplocher",
aplocher / SingleLineAddUser.bat
Last active Apr 28, 2020
A single-line group of commands to add a user with password, and add to a security group. I got too much time on my hands...
View SingleLineAddUser.bat
rem UBER COMMAND!! (v2)
rem One-liner (technically) - prompts for User, Pass, SecGroup. Includes validation, pre-checks for UAC elevated privileges, checks for user pre-existence and group existence before running, requires a User and Group.
cmd /v /c "cls&(net file >nul 2>&1 && ((set /p "u=Enter username: "&&(net user !u! >nul 2>&1&&echo Error: user !u! already exists||(set /p "p=Password: "& set /p "g=Security Group: "&&(net localgroup !g! >nul 2>&1&& (net user !u! !p! /add>nul&&net localgroup !g! /add !u!>nul&&echo SUCCESS: Added new user !u! to group !g!&net user >nul 2>&1)|| (echo Error: specified group does not exist & net user >nul 2>&1))||(echo Error: you must specify a group)))||echo Error: user must not be blank)) || echo Error: you should run as admin)&echo.&echo.&pause"
rem Not-so-UBER command (v1)
rem One-liner, set the User, Pass, Group in the beginning of the command. No prompts, no validation. Lame.
cmd /v /c "set u=myUser&set p=password1&set g=Administrators&cls&net user !u! !p! /add>nul 2>
aplocher / CmderHere.bat
Created Jan 14, 2020
Small bat file that will prompt for Cmder's root dir. It will set the CMDER_ROOT env variable and register "Cmder Here" context menu entries in Windows Explorer.
View CmderHere.bat
@echo off
net file > NUL 2>&1
if not [%ERRORLEVEL%]==[0] (
goto :done
echo Enter the path to the CMDER folder...
aplocher / Program.cs
Created May 30, 2019
A simple C# function (and console app) to flatten an array down to a specified generic type
View Program.cs
using System;
using System.Collections.Generic;
namespace ConsoleApp3
// This is a sample Console App written in C# / .NET Core (but should work with .NET Framework).
// This will flatten an array structure, recursively, down to the generic type specified (or throw an exception if the input is bad)
class Program
aplocher / simplify3d_ending_script.gcode
Created Sep 2, 2018
Simplify 3D G-Code starting script to reduce temp (to reduce oozing), perform homing, auto-leveling, return the temp to the target, and then clean nozzle. Stop script will turn off extruder, bed, move Z up a little bit, move X slightly (so if oozing occurs, hopefully not on the final printed piece), and move Y forward, then turn the fan off afte…
View simplify3d_ending_script.gcode
M104 S0 ; turn off extruder
M140 S0 ; turn off bed
G91 ; relative movement
G1 F150 ; slow Z rate
G1 Z10 ; Z up 15mm
G1 X3 ; X 3mm
G1 Y3 ; Y 3mm
G90 ; back to absolute movement
G1 Y200 F1000
M84 ; disable motors