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
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 / queryToArray.cfm
Last active March 2, 2024 23:25
Convert a ColdFusion/CFML Query to an Array
<cfscript>
public array function queryToArray(query data) {
var local = {};
local.Columns = ListToArray(arguments.Data.ColumnList);
local.QueryArray = ArrayNew(1);
for (local.RowIndex=1; local.RowIndex <= arguments.Data.RecordCount; local.RowIndex++) {
local.Row = {};
for (local.ColumnIndex=1; local.ColumnIndex <= ArrayLen(local.Columns); local.ColumnIndex++) {
local.ColumnName = local.Columns[local.ColumnIndex];
local.Row[local.ColumnName] = arguments.Data[local.ColumnName][local.RowIndex];
@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 / mura-summaryPages.cfm
Created December 12, 2013 23:09
Mura CMS : If a File or Link content type is a child of the Folder, then we want users to go directly to the file or link ... otherwise, File and Link types linked elsewhere in Mura can be taken to a "Summary" view.
<cfscript>
// drop this in your Site or Theme eventHandler.cfc
public any function onRenderStart($) {
if ( $.event('showMeta') != 2 && $.content().getParent().getValue('type') != 'Folder' ) {
$.event('showMeta', 1);
}
}
</cfscript>
Continent_Name Continent_Code Country_Name Two_Letter_Country_Code Three_Letter_Country_Code Country_Number
Asia AS Afghanistan, Islamic Republic of AF AFG 4
Europe EU Albania, Republic of AL ALB 8
Antarctica AN Antarctica (the territory South of 60 deg S) AQ ATA 10
Africa AF Algeria, People's Democratic Republic of DZ DZA 12
Oceania OC American Samoa AS ASM 16
Europe EU Andorra, Principality of AD AND 20
Africa AF Angola, Republic of AO AGO 24
North America NA Antigua and Barbuda AG ATG 28
Europe EU Azerbaijan, Republic of AZ AZE 31
@stevewithington
stevewithington / muraSendEmail.cfm
Last active February 20, 2024 14:33
Mura CMS : How to send an email to the person who submitted the form
<!--- Drop this in your Site or Theme eventHandler.cfc --->
<cffunction name="onAfterFormSubmitSave">
<cfargument name="$">
<cfset var msg = '' />
<cfset var formBean = $.event().getValue('formBean') />
<cfset var formResultBean = $.event().getValue('formDataBean') />
<cfset var formResultStruct = $.event().getValue('formDataBean').getValue('formResult') />
<cfif formBean.getTitle() eq 'Your Desired Form Title'>
<cfsavecontent variable="msg">
@stevewithington
stevewithington / muraImportUsersViaCSV.cfm
Last active January 19, 2024 09:02
Example of how to import Users into Mura CMS via .CSV file. Also see https://gist.github.com/stevewithington/4742829 to import content from an RSS Feed.
<cfscript>
param name='form.csvUrl' default='#getPageContext().getRequest().getScheme()#://#cgi.server_name##getDirectoryFromPath(getPageContext().getRequest().getRequestURI())#users.csv';
param name='form.group' default='Temp';
param name='form.isSubmitted' default='false';
param name='form.isTest' default='true';
param name='form.siteid' default='default';
$ = application.serviceFactory.getBean('$').init(form.siteid);
if ( !$.currentUser().isSuperUser() && !$.currentUser().isInGroup('admin') ) {