Skip to content

Instantly share code, notes, and snippets.

View ststeiger's full-sized avatar
😎
Back from holidays

Stefan Steiger ststeiger

😎
Back from holidays
  • Switzerland
View GitHub Profile
@ststeiger
ststeiger / Generate_Indexes.sql
Created April 18, 2024 14:43
Index Generation script
SELECT
ind.name
,'DROP INDEX ' + QUOTENAME
(
CASE WHEN SUBSTRING(ind.name, 1, 2) = 'ix' THEN 'IX' + SUBSTRING(ind.name, 3, 10000) ELSE ind.name END
) + ' ON ' + QUOTENAME(sch.name) + '.' + QUOTENAME(obj.name) + '; ' AS DropIndexScript
, ' CREATE '
@ststeiger
ststeiger / ffmpeg_split.sh
Created April 2, 2024 15:06
Split all screens video into single screen
Simply convert:
ffmpeg -i input.avi output.mp4
Simply convert, but only the left half of the screen(s):
ffmpeg -i input.avi -filter_complex "[0:v]crop=iw/2:ih:0:0,scale=iw:ih[out]" -map "[out]" output.mp4
Simply convert, but only the right half of the screen(s):
ffmpeg -i input.avi -filter_complex "[0:v]crop=iw/2:ih:ow:0,scale=iw:ih[out]" -map "[out]" output.mp4
@ststeiger
ststeiger / OldTableColorSchema.md
Last active April 3, 2024 13:11
Old Excel Table Color Schema

Alle: =IIF(COUNTROWS("SEL_Standort").Equals(Parameters!in_standort.Count),"Alle","Nicht Alle")

What Color
Title Background #4472C4
Light Blue #D9E1F2
Line #AABEE4
@ststeiger
ststeiger / KickUsers.sql
Created March 21, 2024 18:41
How to kick users from SQL-server
USE master
GO
ALTER DATABASE database_name SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE database_name SET MULTI_USER WITH ROLLBACK IMMEDIATE
@ststeiger
ststeiger / ExecutedQueries.sql
Last active March 21, 2024 12:11
Find past executed queries by text in MSSQL
SELECT
t.[text], qs.creation_time
FROM sys.dm_exec_cached_plans AS p
CROSS APPLY sys.dm_exec_sql_text(p.plan_handle) AS t
JOIN sys.dm_exec_query_stats qs ON p.plan_handle = qs.plan_handle
-- WHERE t.[text] LIKE N'%something unique about your query%';
WHERE t.[text] LIKE N'%CTE%'
-- AND t.text LIKE '%APP-APERTUR%'
ORDER BY qs.creation_time DESC
@ststeiger
ststeiger / named_colors.sql
Last active March 13, 2024 16:49
Names colors / WebColors for SQL
CREATE TABLE IF NOT EXISTS named_colors
(
nc_val int NOT NULL
,nc_r tinyint NULL
,nc_g tinyint NULL
,nc_b tinyint NULL
,nc_name varchar(50) NOT NULL
,nc_hex varchar(7) NULL
,CONSTRAINT pk_named_colors PRIMARY KEY ( nc_name )
@ststeiger
ststeiger / JsonML.js
Last active March 7, 2024 14:41
Json ML generatio from Object
function createHTMLFromJSONML(jsonML)
{
if (!Array.isArray(jsonML) || jsonML.length === 0)
{
return '';
}
const [tag, attributes, ...children] = jsonML;
@ststeiger
ststeiger / testSAML.htm
Last active March 8, 2024 12:57
Testing SAML Login
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate, max-age=0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
@ststeiger
ststeiger / SSRS_Binding_error.md
Last active March 20, 2024 15:15
Fix for An HTTPS binding already exists for the specified IP address and port combination!

This is how to fix this error:
An HTTPS binding already exists for the specified IP address and port combination!

netsh http show sslcert

if too long

netsh http show sslcert > sslcert.txt
@ststeiger
ststeiger / SQL_Browser_Port.txt
Created February 8, 2024 13:26
SQL Browser instance name lookup
The SQL Browser service typically listens on UDP port 1434.
When a client application requests connection information for a specific instance name,
it sends a query to the SQL Browser service on port 1434,
which then responds with the port number associated with the requested instance name.
If the UDP port 1434 is blocked by a firewall, the instance name to port lookup may fail,
resulting in connection issues when using instance names.
In such cases, connecting using the port number directly (e.g., SQL17,2673)
might work if the firewall allows traffic on the specific port.