Skip to content

Instantly share code, notes, and snippets.

@brovish
brovish / wget-exit-codes.txt
Created August 27, 2022 05:39 — forked from cosimo/wget-exit-codes.txt
wget exit codes
This is the list of exit codes for wget:
0 No problems occurred
1 Generic error code
2 Parse error — for instance, when parsing command-line options, the .wgetrc or .netrc…
3 File I/O error
4 Network failure
5 SSL verification failure
6 Username/password authentication failure
7 Protocol errors
/*
================================================
Extended Properties as Database Global Variables
================================================
Author: Eitan Blumin | https://madeiradata.com | https://eitanblumin.com
Date: 2021-06-04
Description:
Use this sample script as a template or starting point
for when you want to utilize extended properties
to save and retrieve values as if using "global" variables
@brovish
brovish / Foreign_Key_Hierarchy_Tree.sql
Created March 20, 2022 17:19 — forked from EitanBlumin/Foreign_Key_Hierarchy_Tree.sql
T-SQL script to retrieve the hierarchy tree for a given table, based on foreign key references.
/*
Retrieve Foreign Key Hierarchy Tree
===================================
Author: Eitan Blumin | https://eitanblumin.com | https://madeiradata.com
Date: 2021-01-07
Description:
Retrieve the hierarchy tree for a given table,
based on foreign key references.
Use this script to map out your entity relational structure,
see which foreign keys are dependent on a given table,
@brovish
brovish / extended properties global variable wrapper functions.sql
Created March 20, 2022 17:17 — forked from EitanBlumin/extended properties global variable wrapper functions.sql
Function and stored procedure to implement Global Variables using Extended Properties
-- Function to Retrieve a global variable value
-- don't forget to convert to the correct data type
CREATE FUNCTION dbo.global_variable(@VariableName sysname)
RETURNS sql_variant
AS
BEGIN
RETURN (SELECT [value]
FROM sys.extended_properties
WHERE major_id = 0 AND minor_id = 0
AND [name] = @VariableName)
@brovish
brovish / printTable.lua
Last active January 23, 2022 11:03 — forked from marcotrosi/printTable.lua
Lua - printTable - print tables on stdout or write into files
--[[
A simple function to print tables or to write tables into files.
Great for debugging but also for data storage.
When writing into files the 'return' keyword will be added automatically,
so the tables can be loaded with 'dofile()' into a variable.
The basic datatypes table, string, number, boolean and nil are supported.
The tables can be nested and have number and string indices.
This function has no protection when writing files without proper permissions and
when datatypes other then the supported ones are used.
--]]
@brovish
brovish / numberToBinStr
Created January 22, 2022 16:59 — forked from lexnewgate/numberToBinStr
Lua- number to binary string
local function numberToBinStr(x)
ret=""
while x~=1 and x~=0 do
ret=tostring(x%2)..ret
x=math.modf(x/2)
end
ret=tostring(x)..ret
return ret
end
@brovish
brovish / download-from-facecast.md
Last active December 25, 2021 10:36 — forked from bigspawn/download-from-facecast.md
How download video from facecast.net
@brovish
brovish / Generate_recommendations_for_clustered_indexes.sql
Created November 14, 2021 17:03 — forked from EitanBlumin/Generate_recommendations_for_clustered_indexes.sql
Use existing non-clustered index usage stats, and missing index stats, to generate clustered-index recommendations for heap tables (more info: https://eitanblumin.com/2019/12/30/resolving-tables-without-clustered-indexes-heaps/ )
-------------------------------------------------------
------ Generate Clustered Index Recommendations -------
-------------------------------------------------------
-- Author: Eitan Blumin | https://www.eitanblumin.com
-- More info: https://eitanblumin.com/2019/12/30/resolving-tables-without-clustered-indexes-heaps/
-------------------------------------------------------
-- Description:
-- ------------
-- This script finds all heap tables, and "guestimates" a clustered index recommendation for each.
-- The script implements the following algorithm:
@brovish
brovish / Parse-XmlFile.ps1
Created June 24, 2021 08:30 — forked from tiagoduarte/Parse-XmlFile.ps1
PowerShell snippet to parse an XML file, and retrieve elements, attributes and inner values
param(
#provide the path for the input xml document
$xmlPath = "C:\temp\tiles-list-elements.xml",
#embed xml (for demo purposes)
$xmlContent = '
<Data>
<Rows>
<Row>
@brovish
brovish / get_gists.py
Created June 3, 2021 11:27 — forked from its-a-feature/get_gists.py
Download all gists for a specific user
# first: mkdir user && cd user && cp /path/to/get_gists.py .
# python3 get_gists.py user
import requests
import sys
from subprocess import call
user = sys.argv[1]
r = requests.get('https://api.github.com/users/{0}/gists'.format(user))