Skip to content

Instantly share code, notes, and snippets.

View stevewithington's full-sized avatar
⛑️
solving problems

Steve Withington stevewithington

⛑️
solving problems
View GitHub Profile
@stevewithington
stevewithington / dbt_to_dbdiagram.rb
Created May 3, 2024 17:38 — forked from pcreux/dbt_to_dbdiagram.rb
Generate an ERD via dbdiagram.io from a dbt project.
#!/usr/bin/env ruby
# Generate a dbdiagram for dbdiagram.io from a dbt project.
#
# Usage:
# 1. Run `dbt docs generate` first.
# 2. Run `dbt_to_dbdiagram.rb`
# 3. Paste the output in https://dbdiagram.io/
require 'yaml'
require 'json'
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@stevewithington
stevewithington / refresh_power_bi_with_python_option_1.ipynb
Last active March 5, 2024 16:57
Refresh Power BI / Fabric with Python : Option 1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stevewithington
stevewithington / refresh_power_bi_with_python_option_2.py
Last active March 5, 2024 16:21
Refresh Power BI / Fabric with Python : Option 2
"""
Tools used to get workspace, dataset names and refresh datasets.
Power BI tools to refresh a dataset using client secret authentication.
Sample use (client id and secret values directly):
tenant_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
app_client_id = "XXXXXXXX-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
app_client_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
app_scope = "https://analysis.windows.net/powerbi/api"
@stevewithington
stevewithington / udf_convert_to_utf16.sql
Last active March 1, 2024 15:22
How to compare Snowflake UTF-8 formatted data to Microsoft SQL Server UTF-16 formatted data
/*----------------------------------------------------------------------------------------
Script: udf_convert_to_utf16.sql
Author: [Steve Withington](steve@digitalmine.com)
Dependencies: n/a
Purpose: MSSQL data is stored in UTF-16 format (UTF-8 support didn't roll out until SQL Server 2019)
Snowflake data is stored in UTF-8 format.
This function will convert a UTF-8 string to a UTF-16, MD5 string for comparison purposes
Note: You probably don't want to use this function directly.
@stevewithington
stevewithington / ToUTF8.sql
Created December 23, 2023 21:04 — forked from sevaa/ToUTF8.sql
Converting an NVARCHAR string to a UTF-8 VARBINARY data block in pure Transact-SQL
create function [dbo].[ToUTF8](@s nvarchar(max))
returns varbinary(max)
as
begin
declare @i int = 1, @n int = datalength(@s)/2, @r varbinary(max) = 0x, @c int, @c2 int, @d varbinary(4)
while @i <= @n
begin
set @c = unicode(substring(@s, @i, 1))
if (@c & 0xFC00) = 0xD800
begin

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

@stevewithington
stevewithington / SAP-Tables-Columns-and-Descriptions.sql
Last active October 28, 2022 13:47
SAP: Query recordset of SAP tables, columns/fields, and their descriptions
USE {YOUR-SAP-DBNAME-GOES-HERE};
GO
SELECT
D3L.POSITION AS SOURCE_COLUMN_POSITION
, D2L.TABNAME AS SOURCE_TABLE_NAME
, D2T.DDTEXT AS SOURCE_TABLE_DESC
, D3L.FIELDNAME AS SOURCE_COLUMN_NAME
, D4T.DDTEXT AS SOURCE_COLUMN_DESC
, D4T.REPTEXT AS SOURCE_COLUMN_HEADER
@stevewithington
stevewithington / setenv.sh
Created October 5, 2022 23:27 — forked from patmandenver/setenv.sh
Tomcat8 setenv.sh
#
# Cutom Environment Variables for Tomcat
#
############################################
export JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre
export PATH=${JAVA_HOME}/bin:${PATH}
############################################
#
# JAVA_OPTS
@stevewithington
stevewithington / emojis.sh
Created September 29, 2022 18:36 — forked from BuonOmo/emojis.sh
A list of all UTF-8 emojis in bash or zsh
# Obtained with the code written in next file
emoji_grinning_face=😀
emoji_grinning_face_with_big_eyes=😃
emoji_grinning_face_with_smiling_eyes=😄
emoji_beaming_face_with_smiling_eyes=😁
emoji_grinning_squinting_face=😆
emoji_grinning_face_with_sweat=😅
emoji_rolling_on_the_floor_laughing=🤣
emoji_face_with_tears_of_joy=😂
emoji_slightly_smiling_face=🙂