Skip to content

Instantly share code, notes, and snippets.

View fairchild's full-sized avatar

Michael Fairchild fairchild

  • Procore
  • California
View GitHub Profile
@rain-1
rain-1 / LLM.md
Last active May 3, 2024 10:05
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pcreux
pcreux / dbt_to_dbdiagram.rb
Created May 3, 2021 16:15
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'
@mashhoodr
mashhoodr / cloudflare_worker_proxy.js
Last active October 10, 2022 16:01
A simple proxy pass script for Cloudflare Worker which handles the basic cases
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
/**
* Respond to the request
* adapted from https://github.com/xiaoyang-liu-cs/workers-proxy
* @param {Request} request
*/
async function handleRequest(request) {
@abelsonlive
abelsonlive / dbt_backfill.py
Created April 11, 2019 02:14
Script for backfilling DBT models which use partitions
#!/usr/bin/env python
import json
import copy
import sys
import argparse
from datetime import datetime, timedelta
from subprocess import Popen, PIPE
# dictionary of partiton names to variable generating functions
@glv
glv / regexp_syntax.md
Last active March 26, 2024 14:28
Ruby and PostgreSQL Regular Expressions

Ruby and Postgres Regular Expression Syntaxes

Ruby's regular expressions are unusually powerful. Postgres' regular expressions are not as powerful, but they come close; close enough that it's possible to do many pattern-based queries and string transformations entirely in a query.

And sometimes, it's very useful to have a single regular expression that works

@kerlin
kerlin / get_workers.rb
Last active November 17, 2021 02:03
Calling the Workday API in Ruby with Savon
#!/usr/bin/env ruby
#
# Example Ruby CLI script to retrieve worker data from Workday
# Call on command line with worker id; prints worker name
# add "request" or "response" after worker id and prints the
# outgoing xml or received hash and exits.
#
# Using Savon version 2 for the SOAP client (2.11.2)
#
# Savon defaults to making the message tag the same as the operation name
@soultech67
soultech67 / ruby_readline_issue.md
Last active June 6, 2022 21:18
ruby bundler: Sorry, you can't use byebug without Readline

Preamble

On OS/X Sierra, after recently running a brew update I started receiving the error message Sorry, you can't use byebug without Readline when trying to run some rake tasks in my ruby project folder. I observed this in projects and gems that include byebug or pry in their Gemfile or gem.spec. I've found in my googling that many begin encountering this error message after running a brew update but there are other triggering conditions as well.

>> rake aws:show_config
WARN: Unresolved specs during Gem::Specification.reset:
      mime-types (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
 Sorry, you can't use byebug without Readline. To solve this, you need to
@keithpitt
keithpitt / database_state_loader.rb
Last active June 10, 2022 16:32
Note that this code only works with PostgreSQL, but it wouldn’t be too hard to adapt our approach for other relational databases.
# Add to `spec/support/database_state_loader.rb`
class DatabaseStateLoader
class EnvironmentError < RuntimeError; end
def self.load(path)
new(path).load
end
def initialize(path)