Skip to content

Instantly share code, notes, and snippets.

@aplocher
aplocher / data-dict-gen.sql
Created February 8, 2021 22:10
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
use my-database
go
declare @tableList table (Id int not null primary key identity, DatabaseName varchar(50), SchemaName varchar(50), TableName varchar(50), TableDescription varchar(max))
-- #### CONFIGURATION:
-- Which tables to generate the markdown for?
insert into @tableList (DatabaseName, SchemaName, TableName, TableDescription) values
('my-database', 'dbo', 'Entity', ''),
@aplocher
aplocher / data-dict-gen-simple.sql
Created February 8, 2021 22:04
T-SQL script to generate data dict. markdown to be used in Azure DevOps Wiki from a SQL Server table
use varis_p
go
declare
@table varchar(50) = 'dbo.SomeTable'
select md from (
-- Row 1 - Headers
select
-2 as colid,
{
"basics": {
"name": "Adam Plocher",
"picture": "https://avatars0.githubusercontent.com/u/1132447?v=4",
"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": "http://blog.bitcollectors.com/adam",
"yearsOfExperience": 19,
"username": "aplocher",
@aplocher
aplocher / CmderHere.bat
Created January 14, 2020 23:43
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.
@echo off
net file > NUL 2>&1
if not [%ERRORLEVEL%]==[0] (
echo ERROR - RUN AS ADMIN
echo.
goto :done
)
echo Enter the path to the CMDER folder...
@aplocher
aplocher / Program.cs
Created May 30, 2019 01:25
A simple C# function (and console app) to flatten an array down to a specified generic type
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
aplocher / simplify3d_ending_script.gcode
Created September 2, 2018 08:43
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…
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
@echo off
setlocal
:: <config>
:: CONFIGURATION STUFF BELOW
:: Base folder where the new sub-folders will be created. Do NOT include a trailing slash [eg, c:\temp is ok, but not c:\temp\]
set "baseDir=C:\TEMPOUTPUT"
:: The second destination to recieve a copy of these files
set "baseDir2=C:\TEMPOUTPUT2"
@aplocher
aplocher / clapper.py
Last active March 17, 2017 05:36
Python script to detect signal from MAX4466 Mic Amp and send an RF signal to power on/off a plug when it detects two clap sounds (aka "DIY The Clapper"). Implemented on Raspberry Pi Zero
#!/usr/bin/python
#
# usage: clapper.py [-h] [--on | --off]
#
# With no arguments, this will run continuously and listen for clap noises to
# trigger an RF power plug to turn on or off (aka The Clapper). Can
# alternatively be used to manually control a power plug with arguments
#
# optional arguments:
# -h, --help show this help message and exit
@aplocher
aplocher / setup_mssql.ps1
Created January 21, 2017 08:27 — forked from DamianZaremba/setup_mssql.ps1
MSSQL Server Setup - designed to be run via ssh, ie vagrant under opentable/win-2012r2-standard-amd64-nocm
$ErrorActionPreference = "Stop"
$client = new-object System.Net.WebClient
# Reset vagrant password so it's not expired
([adsi]"WinNT://vagrant-2012-r2/vagrant").SetPassword("P@55w0rd!")
# Setup UAC wrapper ;(
if(!(Test-Path -Path "C:\uacts_x64.zip")) {
Write-Output "Setting up UAC wrapper"
$client.DownloadFile("http://www.itknowledge24.com/files/uacts_x64.zip", "C:\uacts_x64.zip")
@aplocher
aplocher / GStreamer-1.0 some strings.sh
Created September 20, 2016 08:51 — forked from strezh/GStreamer-1.0 some strings.sh
GStreamer-1.0 personal cheat sheet
#!/bin/bash
# play YUV444 FULL HD file
gst-launch-1.0 -v filesrc location=size_1920x1080.yuv ! \
videoparse width=1920 height=1080 framerate=25/1 format=GST_VIDEO_FORMAT_Y444 ! \
videoconvert ! \
autovideosink
# play YUV422 FULL HD file
gst-launch-1.0 -v filesrc location=size_1920x1080.yuv ! \