Skip to content

Instantly share code, notes, and snippets.

View chrisgoddard's full-sized avatar

Chris Goddard chrisgoddard

View GitHub Profile
@palewire
palewire / README.md
Last active May 24, 2023 18:09
How to deploy a Prefect agent to Google Kubernetes Engine

How to deploy a Prefect agent to Google Kubernetes Engine

This post contains code and commands you can use to deploy Prefect agents to Google Cloud’s Google Kubernetes Engine. The agents stand ready to execute workflows triggered by Prefect projects. One agent can run tasks from multiple projects.

The example here demonstrates how to create a single agent with minimal customization. It is configured with a Dockerfile, which installs necessary dependencies, and a k8s.cfg file, which connects the system to a Prefect account.

Agents are deployed via the gcloud command-line utility and its kubectl extension. Proper permissions within a project on Google Cloud are required.

Getting started

@krisjan-oldekamp
krisjan-oldekamp / google_analytics_bigquery_user_mapping_table_customer.sql
Last active February 26, 2024 08:52
How to create a user mapping table (or Identity Graph) based on all the available user identifiers in the Google Analytics 4 BigQuery exports (like device-IDs or customer-IDs). Full article on stacktonic.com
-- Author: Krisjan Oldekamp
-- https://stacktonic.com/article/create-a-user-mapping-table-based-on-the-google-analytics-4-big-query-dataset
declare lookback_window int64 default 90; -- how many days to lookback into the dataset to search for ids (compared to today)
-- udf: deduplicate array of struct
create temp function dedup(arr any type) as ((
select
array_agg(t)
from (
@sanealytics
sanealytics / tf_idf.sql
Created January 7, 2020 04:43
TF/IDF in Bigquery SQL
-- calculate td/idf
create or replace view scratch.v_elt_calculate_tf_idf
as
with
params as (
select 3 as MIN_TOK,
5 as MAX_RNK,
CURRENT_DATETIME() as added_ts,
100 as MIN_TF
),
@mattmc3
mattmc3 / modern_sql_style_guide.md
Last active April 8, 2024 22:53
Modern SQL Style Guide
layout author title revision version description
default
mattmc3
Modern SQL Style Guide
2019-01-17
1.0.1
A guide to writing clean, clear, and consistent SQL.

Modern SQL Style Guide

@0xjac
0xjac / private_fork.md
Last active April 24, 2024 15:00
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@kaugesaar
kaugesaar / GeoSearch.js
Last active October 17, 2021 12:37
Fake your Google searches location with uule parameter.
var GeoSearch = function() {
this.baseUrl = 'https://www.google.se/search?';
this.pws = true;
this.lang = 'sv';
var key = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
var makeHash = function(loc) {
loc = loc.toLowerCase().replace(/[åä]/g,'a').replace(/[ö]/g,'o');
return 'w+CAIQICI' + key[loc.length%key.length] + btoa(loc).replace(/\=/g,'').trim();
@sshay77
sshay77 / gist:4b1f6616a7afabc1ce2a
Created July 18, 2015 15:15
google-search-url-parameters-query-string-
// ==UserScript==
// @name Google Search Better Privacy
// @description Delete unnecessary params and add useful params on Google Search.
// @version 0.0.4
// @include http://*.google.*/search*
// @include http://*.google.*/imgres*
// @include https://*.google.*/search*
// @include https://*.google.*/imgres*
// @exclude http://play.google.com/*
// @exclude http://mail.google.com/*
@MurtzaM
MurtzaM / preventNonBusinessEmailSubmission.js
Created September 9, 2014 23:49
This script will prevent Marketo form submission if a user enters a non-business email (Gmail, Hotmail, etc.)
//This script prevents Marketo form submission if a user enters non-business email (Gmail, Hotmail, Yahoo, etc.)
//It will work on any page with a Marketo form, and runs when the form is ready
//For further info, please see Marketo form documentation, http://developers.marketo.com/documentation/websites/forms-2-0/
//Prepared by Ian Taylor and Murtza Manzur on 9/9/2014
<script>
(function (){
// Please include the email domains you would like to block in this list
var invalidDomains = ["@gmail.","@yahoo.","@hotmail.","@live.","@aol.","@outlook."];
@bsweger
bsweger / useful_pandas_snippets.md
Last active April 19, 2024 18:04
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@avibryant
avibryant / bayesab.js
Last active March 22, 2021 18:36
An implementation of http://www.evanmiller.org/bayesian-ab-testing.html with no depenedencies
function probabilityBBeatsA(aa, ba, ab, bb) {
var probability = 0.0;
for(var i = 0; i < ab; i++) {
var product = Math.log(1 + (aa + ba)/(i + bb));
var j = 1;
var start = i+1;
[bb, ba, aa, i].forEach(function(steps){
var stop = start + steps;