Skip to content

Instantly share code, notes, and snippets.

View film42's full-sized avatar
✔️
Verified

Garrett Thornburg film42

✔️
Verified
View GitHub Profile
@film42
film42 / tableau cloud proxy.md
Created June 30, 2025 14:19
Make tableau work around

Why a tableau cloud proxy?

It turns out that usage based embedded tableau reports (the kind where you create an SSO token for no specific user) do not work with Safari on Mac or iOS. Why? Because when the Tableau SDK signs in with your single use token, the response contains a session cookie; and, since the browser is receving this from a domain that is not the same as the page you're on, Safari assumes this is an advertiser attempting to track you, and drops the cookie.

To work around this limitation, you need to make Tableau match the domain of your web app. I've seen a few examples out there like deploying an nginx container, or writing a custom app controller, etc. My solution was to make a simple load balancer in Google Cloud that would proxy all traffic to a Tableau endpoint--and it works really well.

Attached is the pulumi code I used for this. If you're following in my footsteps, this should work out of the box after updating the code to use your own domain. Also, if you're like me, and allow cus

@film42
film42 / a_usage.py
Created October 24, 2024 22:08
Write a dataframe to BigQuery using the Storage Write API with Flexible Columns with dynamic protos
# NOTE: The BigQueryTable class is something we wrote to wrap a bunch of operations and migrate tables,
# but you can catch the gist of what we're doing. Converting types is not the hard part.
#
# NOTE: The protobuf descritpor comes from: https://github.com/googleapis/googleapis/blob/master/google/cloud/bigquery/storage/v1/annotations.proto
import big_query_storage_write_api as s
s.to_gbq(
df=df,
table=internal.BigQueryTable("some_table"),
@film42
film42 / tokio_diesel.rs
Created August 3, 2021 20:09
Forked tokio diesel
use async_trait::async_trait;
use diesel::{
connection::SimpleConnection,
dsl::Limit,
query_dsl::{
methods::{ExecuteDsl, LimitDsl, LoadQuery},
RunQueryDsl,
},
r2d2::{ConnectionManager, Pool, R2D2Connection},
result::QueryResult,
@film42
film42 / Counting.actor.cpp
Last active January 17, 2019 03:23
Simple example using foundationdb's Flow
#include <iostream>
#include <vector>
#include "flow/flow.h"
#include "flow/DeterministicRandom.h"
#include "flow/actorcompiler.h"
// Simple counting actor that:
// 1. Logs a tag on start and finish.
// 2. Waits for some time.
// 3. Returns the new number.
@film42
film42 / sketching_a_disk_backed_queue.rb
Last active August 27, 2017 20:37
Exploring different back pressure mechanism for active publisher
require "pstore"
require "thread"
require "securerandom"
module ActivePublisher
module Async
module DiskBackedQueue
class Page
attr_reader :file_path
@film42
film42 / redirect.go
Created August 24, 2017 00:32
If you need to go from io.Reader to io.Reader but need to do a streaming io.Writer -> io.Reader before hand, this redirects the output
type NoOpWriteCloser struct {
writer io.Writer
}
func (c *NoOpWriteCloser) Write(p []byte) (int, error) {
return c.writer.Write(p)
}
func (c *NoOpWriteCloser) Close() error {
return nil
}
@film42
film42 / tls_cert_key_and_ca_jruby.rb
Created April 9, 2017 22:49
Load a x509 cert + rsa key and x509 ca and create an sslcontext in java using jruby. This took me a few hours to figure out since I wasn't super familiar with java, but here you go! Btw, you'll notice I'm using bouncycastle which is fine because it's a dependency of jruby-openssl. So as long as you require "openssl" this should work out of the box.
require "openssl"
def create_ssl_context(options)
# Create our certs and key converters to go from bouncycastle to java.
cert_converter = org.bouncycastle.cert.jcajce.JcaX509CertificateConverter.new
key_converter = org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter.new
# Load the certs and keys.
tls_ca_cert = cert_converter.getCertificate(read_pem_object_from_file(options[:tls_ca_cert]))
tls_client_cert = cert_converter.getCertificate(read_pem_object_from_file(options[:tls_client_cert]))
@film42
film42 / pg.rb
Last active April 3, 2017 03:09
require "socket"
class Client
def initialize(addr, port, user, db)
@user = user
@db = db
@socket = TCPSocket.new(addr, port)
end
def login_packet
module Protobuf
module Nats
class ThreadPool
def initialize(size, opts = {})
@queue = ::Queue.new
@active_work = 0
# Callbacks
@error_cb = lambda {|_error|}
# frozen_string_literal: true
module Arel
module Visitors
class Visitor
def initialize
@dispatch = get_dispatch_cache
@random = [0.1, 0.5, 1, 2, 4]
end
def accept object