Skip to content

Instantly share code, notes, and snippets.

View potatoqualitee's full-sized avatar
big permz energy

Chrissy LeMaire potatoqualitee

big permz energy
View GitHub Profile
@potatoqualitee
potatoqualitee / screenshot.js
Created August 30, 2022 10:31
screenshot.js
var { chromium } = require('playwright');
(async function () {
var themeparam = process.argv[2];
var path = require('path');
var fs = require('fs');
var directoryPath = path.join(__dirname, 'themes');
var file = path.join(directoryPath, `${themeparam}.json`);
console.log("processing " + file);
@potatoqualitee
potatoqualitee / Get-DupesinCSV.ps1
Created March 31, 2015 08:41
Quickly Find Duplicates in Large CSV Files using PowerShell
# From https://blog.netnerds.net/2015/01/quickly-find-duplicates-from-csv-using-powershell/
# The Text OleDB driver is only available in PowerShell x86. Start x86 shell if using x64.
# This has to be the first check this script performs.
if ($env:Processor_Architecture -ne "x86") {
Write-Warning "Switching to x86 shell"
&"$env:windir\syswow64\windowspowershell\v1.0\powershell.exe" "$PSCommandPath $args"; return
}
# Change to your CSV file name, must end in .csv or .tsv
$csvfile = "C:\temp\million-commas.txt"
@potatoqualitee
potatoqualitee / Export-FileIcon.ps1
Created January 29, 2020 21:22
Export-FileIcon.ps1
Function Export-FileIcon {
<#
.SYNOPSIS
Export-FileIcon exports high-quality icons stored within .DLL and .EXE files.
.DESCRIPTION
Export-FileIcon exports high-quality icons stored within .DLL and .EXE files. The function can export to a number of formats, including
ico, bmp, png, jpg, gif, emf, exif, icon, tiff, and wmf. In addition, it can also export to a different size.
@potatoqualitee
potatoqualitee / advanced-datatable.ps1
Created February 3, 2015 04:24
Formatting Data within .NET DataTables using PowerShell
# Create Basic Datatable
$datatable = New-Object System.Data.Datatable
[void]$datatable.Columns.Add("name")
[void]$datatable.Columns.Add("directory")
[void]$datatable.Columns.Add("bytes", [double])
# Add data
[void]$datatable.Rows.Add("locate","C:",1.0)
[void]$datatable.Rows.Add("Backup","C:\locate",1.0)
[void]$datatable.Rows.Add("Invoke-Locate.ps1","C:\locate",39630.0)
# Set some vars
$new = "localhost\sql2016"
$old = $instance = "localhost"
$allservers = $old, $new
# Alternatively, use Registered Servers?
Get-DbaCmsRegServer -SqlInstance $instance | Out-GridView
# Quick overview of commands
Start-Process https://dbatools.io/commands
@potatoqualitee
potatoqualitee / swagger.json
Created November 28, 2022 18:47
swagger.json
{
"openapi": "3.0.0",
"info": {
"title": "Mastodon API",
"description": "This an attempt to document Mastodon's API based on the code in https://github.com/mastodon/mastodon",
"contact": {
"name": "Malcolm VanOrder",
"email": "mvanorder1390@gmail.com"
},
"license": {
@potatoqualitee
potatoqualitee / encryption-commands.md
Created November 16, 2022 12:12
Encryption Commands

Thanks for attending the session! Here are all of our related security commands:

Add-DbaComputerCertificate              
Backup-DbaComputerCertificate           
Backup-DbaDbCertificate                 
Backup-DbaDbMasterKey                   
Backup-DbaServiceMasterKey              
Disable-DbaDbEncryption                 
Disable-DbaForceNetworkEncryption       
@potatoqualitee
potatoqualitee / profile.ps1
Last active November 4, 2022 19:37
prompt
function Prompt
{
Write-Host "[" -NoNewline
Write-Host (Get-Date -Format "HH:mm:ss") -ForegroundColor Gray -NoNewline
try
{
$history = Get-History -ErrorAction Ignore
if ($history)
{
@potatoqualitee
potatoqualitee / dbcombobox.ps1
Created November 27, 2015 12:07
Classic Forms Get-DBComboBox example
$sqlserver = "sqlserver2014a"
Function Get-SqlDatabases {
param(
[Parameter(Mandatory=$true)]
[string]$SqlServer,
[object]$Credential
)
$paramconn = New-Object System.Data.SqlClient.SqlConnection
@potatoqualitee
potatoqualitee / Show-WPFIconExample.ps1
Last active September 26, 2022 11:03
Toolbar Icons for PowerShell WPF GUI - Updated Jan 7 to support keyboard interaction.
# THIS CODE CANNOT BE COPY/PASTED INTO THE CONSOLE. PLEASE SAVE IT AS A FILE AND EXECUTE.
# Add required assemblies
Add-Type -AssemblyName PresentationFramework, System.Drawing, System.Windows.Forms, WindowsFormsIntegration
# Setup the XAML
[xml]$script:xaml = '<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Acadiana (Cajun) Flag" Height="240" Width="320" Background="Gray">
<Window.TaskbarItemInfo>