Skip to content

Instantly share code, notes, and snippets.

View gnilrets's full-sized avatar

Sterling Paramore gnilrets

View GitHub Profile
@gnilrets
gnilrets / GoodDataRestPOC.rb
Last active February 12, 2018 12:04
Download a GoodData report as CSV using REST API and Ruby
require 'rubygems'
require 'bundler/setup'
require 'rest_client'
require 'yaml'
require 'json'
# Working example of using the GoodData REST API to download a report.
# This demonstrates two different methods, one is to download the
# the report as computed on the UI, the other is to download the
@gnilrets
gnilrets / install-ruby-rbenv-bundler-os_x.md
Last active August 29, 2015 14:11
Quickstart instructions for installing Ruby, Rbenv and Bundler on OS X
@gnilrets
gnilrets / daru-csv-benchmarks.rb
Last active November 12, 2015 18:44
Daru-CSV-Benchmarks
require 'bundler/setup'
require 'daru'
require 'benchmark'
require 'yaml'
filename = 'Application_1470_20151111010006.txt'
def bench(name, &block)
time = Benchmark.realtime do
@gnilrets
gnilrets / HACKER.BAS
Last active June 24, 2017 01:29
Best code ever - ca 1994
htrojans = 5
hbackups = 5
megs = 50
cash = 500
computer$ = "Apple Ie"
backup$ = "Paper Strips"
hack$ = "Yourself"
intel$ = "no"
dumbnerdone = 100
start:
@gnilrets
gnilrets / tableau_snowflake_migrator.py
Created April 3, 2020 23:00
Tableau Workbook Redshift->Snowflake Migrator
'''
Tableau Workbook Redshift->Snowflake Migrator
=============================================
This is heavily based on previous work here https://github.com/calogica/tableau-redshift-snowflake-converter/blob/master/Tableau%20Redshift%20to%20Snowflake%20Migration%20Script.ipynb
This script converts Tableau packaged workbooks from Redshift to Snowflake. It works by
parsing the workbook XML. It will replace datasource connections so they point to your
Snowflake instance instead of Redshift. Additionally, the script will UPCASE schemas,
tables, and any columns that don't have characters that need to be quoted.
@gnilrets
gnilrets / trange_join.sql
Last active October 27, 2024 12:02
dbt Snapshot Join
{% macro trange_join(left_model, left_fields, left_primary_key, right_models) %}
{#
This macro allows the user to join two or more snapshot models together on a common
key, with the result being a unique record for each distinct time range. For example,
Given left_model:
| {{ join_key }} | left_field | dbt_valid_from | dbt_valid_to |
| - | - | - | - |
| k1 | L1 | 2020-01-01 | 2020-01-05 |
| k1 | L2 | 2020-01-05 | 2999-12-31 |