Skip to content

Instantly share code, notes, and snippets.

View matthew-n's full-sized avatar

Matt N. matthew-n

  • Houston, Tx
View GitHub Profile
@mhitza
mhitza / vim-guile.md
Last active July 15, 2024 01:26
vim + GNU Guile development environment

This document was based on my local [GNU Guile][1]-3.0.5 setup. I'm not sure if it works as is with an older version of GNU Guile.

Because of a [dependency in Fedora][2] I had to compile GNU Guile from source release. As such, in your local setup the paths will differ. This is only relevant when defining the GUILE shell variable, and referencing the tags file in the vimrc.

Note that when building GNU Guile from source be sure that you have the readline-devel (or distro equivalent package) installed. That way the ./configure step will pick that up, and the ice-9 readline module will be usable.

@tcartwright
tcartwright / GetBackupInformation.sql
Last active March 4, 2021 15:19
SQL SERVER: Backups info (Can be visualized in OUTLOOK)
/*
Tim C: This query can be used as a normal query, or it can also be used to import into an OUTLOOK calendar so
you can visualize your backups. Similar to https://dbatools.io/timeline/
RECOMMENDATIONS:
1) You should import into a CUSTOM blank excel calendar
2) You should not import TLOG backups, as that will utterly bloat the calendar
******************************************************************************************
TO CREATE A NEW CALENDAR:
@tcartwright
tcartwright / ExtractMissingIndexesFromPlan.ps1
Last active January 25, 2021 15:03
SQL SERVER ExtractMissingIndexesFromPlan
[CmdletBinding()]
Param (
[Parameter(Mandatory=$true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[string] $path
)
Clear-Host
[xml]$plan = Get-Content -Path ($path.TrimStart('"').TrimEnd('"'))
@tcartwright
tcartwright / CombinePlans.ps1
Created January 21, 2021 18:19
SQL SERVER: Combine Plans into One
[CmdletBinding()]
Param (
[Parameter(Mandatory=$true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[string] $ServerInstance,
[Parameter(Mandatory=$true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[string] $planHandle
)
<#
@tcartwright
tcartwright / GetGatewayCounts.sql
Last active January 20, 2021 16:35
SQL Server: Get memory gateway counts from DBCC MEMORYSTATUS
/*
Author: Tim Cartwright, Daniel Berber
Purpose: To get the compile gateway counts out of sql server. Most likely if you are hitting gateway issues,
you are seeing RESOURCE_SEMAPHORE_QUERY_COMPILE wait stats. The gateways act as a sort of funnel.
The more compile memory a plan needs, the bigger the gateway required. If the number of queries being compiled
for that gate way exceed the available count then the following queries will get stuck waiting with the
RESOURCE_SEMAPHORE_QUERY_COMPILE wait stat.
If you are using SQL Server 2016 or greater you can use: sys.dm_exec_query_optimizer_memory_gateways
@xzilla
xzilla / postgres12demos.sql
Last active May 29, 2020 20:46
Whats New In PostgreSQL 12 => Demos Only
\q
/*
What's New In PostgreSQL 12: All Demo Edition
Robert Treat (@robtreat2) - v5 - 2020-05-23
Requirements:
Postgres 12
@tcartwright
tcartwright / Scan Database for value.md
Last active January 11, 2023 14:58
SQL SERVER: Scans a SQL Server for a value, and lists all columns matching that value
@dazfuller
dazfuller / License.md
Last active July 2, 2024 12:37
Exporting data from a database to Parquet files in .NET (Core). This demo application targets a SQL Server database but the code could be re-used to target other database solutions.

MIT License

Copyright (c) 2018 Darren Fuller

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

select
test,
query::char(48),
instance,
--scale,
--clients,
round(mean_time::numeric, 4) mean_time,
round(stddev_time::numeric, 4) stddev_time,
round(((mean_time - mean_time_lag)::numeric / mean_time::numeric )*100, 1) as mean_time_diff,
round(((stddev_time - stddev_time_lag)::numeric / stddev_time::numeric )*100, 1) as stddev_time_diff