.
View Start SQL Server Container.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start SQL Server docker instance | |
function Start-SQLServer { | |
param ( | |
[Parameter()][string]$Tag = 'latest' | |
) | |
$containerName = 'sqlserver' | |
$sa_password = 'yourStrong(!)Password' | |
$container = docker inspect $containerName | ConvertFrom-Json |
View datetime conversion testing.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @dto datetimeoffset, @dt2 datetime2, @dt datetime, @sdt smalldatetime, @d date, @t time; | |
SELECT @dto = SYSDATETIMEOFFSET(), @dt2 = @dto, @dt = @dto, @sdt = @dto, @d = @dto, @t = @dto; | |
WITH cte_tally AS (SELECT ID = ROW_NUMBER() OVER (ORDER BY (SELECT 1)) FROM sys.messages) | |
SELECT x.FormatCode, x.[datetimeoffset], x.[datetime2], x.[datetime], x.[smalldatetime], x.[date], x.[time] | |
FROM ( | |
SELECT FormatCode = N'██ Source' | |
, [datetimeoffset] = CONVERT(nvarchar(60), @dto, 121) | |
, [datetime2] = CONVERT(nvarchar(60), @dt2, 121) | |
, [datetime] = CONVERT(nvarchar(60), @dt, 121) | |
, [smalldatetime] = CONVERT(nvarchar(60), @sdt, 120) |
View alert - garage door open - no motion.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tts: | |
- platform: google_translate | |
template: | |
- binary_sensor: | |
- name: garage_open_no_motion | |
state: > | |
{{ | |
(is_state('binary_sensor.contact_7_contact', 'on')) | |
and |
View Garage Left Open - Loop.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias: Garage Door Open Notification | |
description: Send out repeating notifications or announcements that the garage door is left open | |
mode: restart | |
trigger: | |
- platform: state | |
entity_id: | |
- group.garage_motion | |
- binary_sensor.contact_7_contact | |
condition: | |
- condition: state |
View zz Filename Start with Space - added via git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you try to add a space to the name in GitHub, it gets trimmed. | |
If you try to add a space to the name in Windows, it gets trimmed. | |
The best option seems to be to add the file via command line with the space in the name, then commit and push. |
View test_ripgrep_glob.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$string = 'Tables' | |
$result = '','/','*/','**/' | ? {$true} -PV left | | |
% { '','/','/*','/**' } -PV right | | |
% { | |
$glob = "${left}${string}${right}" | |
$stat = Measure-Command { $list = rg --files -g $glob } | |
[pscustomobject]@{ | |
Glob = $glob | |
Count = $list.Count | |
Stat = $stat.Milliseconds |
View find_dependencies.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH find_dependencies AS ( | |
-- List of objects referencing an external database | |
-- Root node | |
SELECT DISTINCT Referencing_ObjectName = o.[name] | |
, Referencing_ObjectSchema = OBJECT_SCHEMA_NAME(o.[object_id]) | |
, Referencing_ObjectType = x.ObjectType | |
FROM sys.sql_expression_dependencies d | |
JOIN sys.objects o ON o.[object_id] = d.referencing_id | |
CROSS APPLY (SELECT ObjectType = CASE o.[type] WHEN 'P' THEN 'Stored Procedures' WHEN 'V' THEN 'Views' WHEN 'FN' THEN 'Functions' WHEN 'TF' THEN 'Functions' ELSE NULL END) x | |
WHERE d.is_ambiguous = 0 |
View sample_template_sensor.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# configuration.yaml | |
template: | |
- sensor: | |
- name: new_entity_id | |
device_class: power | |
unit_of_measurement: W # watts | |
state: "{{ states('sensor.target_entity_id') | default(0, true) | round(2, default=0) }}" | |
# customize.yaml | |
sensor.new_entity_id: |
View gauge.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder