Skip to content

Instantly share code, notes, and snippets.

View coreymcmahon's full-sized avatar

Corey McMahon coreymcmahon

View GitHub Profile
@coreymcmahon
coreymcmahon / create-order.json
Created September 5, 2023 05:57
Sample "create order" webhook for Foodkit orders
{
"data":
{
"address":
{
"address1": "115 Pitt st",
"address2": "Suite 15",
"address_label": "Office",
"building_name": "Pitt St Building",
"directions": "Call when you arrive in the foyer",
@coreymcmahon
coreymcmahon / write-commit-hash.sh
Last active January 20, 2023 09:03
Envoyer - write Git hash to a file (public/version.html)
###
# Useful when constructing a "version number" for display in the application
cd {{ release }}
echo {{ sha }} | cut -c -8 > ./public/version.html
date -u +"%Y-%m-%d %T" >> ./public/version.html
###
# public/version.html will contain:
#
# fad315b1
@coreymcmahon
coreymcmahon / failure-modes-of-chatgpt.md
Created December 29, 2022 13:21
"Failure modes of Chat GPT", as written by ChatGPT

Introduction

In recent years, the use of chatbots and conversational AI systems has become increasingly popular for tasks such as customer service, e-commerce, and entertainment. One type of chatbot that has gained particular attention is the "GPT chatbot," which is based on the Generative Pre-training Transformer (GPT) language model developed by OpenAI. These chatbots are able to generate human-like responses to user input, making them well-suited for natural language processing tasks.

However, like any complex system, chat GPTs are not without their limitations and failure modes. In this blog post, we will explore some of the common failure modes of chat GPTs and discuss ways in which they can be mitigated.

What is GPT and how does it work?

Before diving into the failure modes of chat GPTs, it is important to first understand how GPT works. GPT is a type of transformer-based language model that uses machine learning techniques to generate human-like text. It does this by predicting the next word

@coreymcmahon
coreymcmahon / postgres14.sh
Last active December 28, 2022 15:51
Postgres 14 installation on Ubuntu 20+
# Install Postgres 14
sudo apt-get update
sudo apt-get -y upgrade
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/postgresql-pgdg.list > /dev/null
# Might need to do this if you get "...public key is not available: NO_PUBKEY 7FCC7D46ACCC4CF8"
# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <MISSING PUBKEY>
sudo apt-get update
sudo apt-get install -y postgresql-14
@coreymcmahon
coreymcmahon / EnumWithoutEnum.ts
Created November 14, 2022 10:13
Create an enum-like type, without using enums directly (which has some peculiarities)
export const ReturnStatus = {
UNFILED: 0,
FILED: 1,
COMMITTED: 2,
PAID: 3,
PARTIALLY_PAID: 4,
} as const;
type ReturnStatus = typeof ReturnStatus[keyof typeof ReturnStatus];
@coreymcmahon
coreymcmahon / sample.json
Created October 4, 2022 10:13
Sample menu item JSON
{
"uuid": "04fe4a9f-eed9-4c09-8edd-8001ec8be6b0",
"price": 798,
"is_available": true,
"images": []
"locales": {
"en": {"name": "Gyoza"},
"jp": {"name": "餃子"}
}
}
@coreymcmahon
coreymcmahon / replace-all.sh
Created July 14, 2022 05:36
Replace each character in a given string with all 0's
# Takes the first argument and replaces all characters with '0'
node -e 'console.log(process.argv[1].split("").map(() => "0").join(""))' "<here>"
@coreymcmahon
coreymcmahon / init.vim
Last active February 22, 2022 10:42
Neovim config
let g:netrw_banner = 0
" Sane defaults
syntax on " syntax highlighting
set noerrorbells " no sound effects
set tabstop=4 softtabstop=4 " 4 spaces
set shiftwidth=4 " tab adds 4 spaces
set expandtab " use spaces instead of tabs
set smartindent " try to indent
set number relativenumber " nice line numbers
@coreymcmahon
coreymcmahon / setup.sh
Last active January 24, 2022 04:39
Setup new box
# Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Dev environment
brew install git iterm2 tmux neovim
# Source code pro
curl -LO https://github.com/adobe-fonts/source-code-pro/archive/release.zip
unzip release.zip
cp -a source-code-pro-release/TTF/* ~/Library/Fonts
@coreymcmahon
coreymcmahon / setup-vim-js-ts.sh
Last active December 22, 2021 03:58
Set up Vim for JS, TS, etc.
# Install vim-plug
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# ... add vim-plug to vimrc
call plug#begin()
Plug 'tpope/vim-sensible'
" On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }