Skip to content

Instantly share code, notes, and snippets.

@brandon-braner
brandon-braner / worksheetnames.vba
Created June 13, 2024 04:49
VBA for assigning cell names based on code name
Sub GetValuesFromSheets()
Dim ws As Worksheet
Dim sheetNames As Variant
Dim cellNames As Variant
Dim i As Long
Dim cellValue As Variant
Dim cellName As Variant
' Define the code names of the sheets you want to loop over
@brandon-braner
brandon-braner / create_tables.sql
Last active March 24, 2024 00:30
openalex_create_tables
--
-- PostgreSQL database dump
--
-- Dumped from database version 13.5 (Ubuntu 13.5-2.heroku1+1)
-- Dumped by pg_dump version 14.1
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
@brandon-braner
brandon-braner / main.go
Created March 19, 2024 21:13
my attempt at processing a large csv
package main
import (
"database/sql"
"encoding/csv"
"fmt"
_ "github.com/lib/pq" // add this
"io"
"log"
"os"
@brandon-braner
brandon-braner / inheritance_vs_composition.md
Created October 31, 2023 20:40
Inheritance vs Composition

Composition vs Inheritance

Inheritance

Inheritance is the process by which one class takes on the attributes and methods of another. Newly formed classes are called child classes, and the classes that child classes are derived from are called parent classes.

This is a is-a relationship. The child class is a type of the parent class.

@brandon-braner
brandon-braner / index.html
Created July 20, 2023 18:46
auth0-github
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdn.auth0.com/js/auth0/9.18/auth0.min.js"></script>
<title>Document</title>
</head>
@brandon-braner
brandon-braner / dep-in.py
Last active June 22, 2023 14:21
FastAPI Depdency Injection Example
from fastapi import FastAPI, Depends
from myservice import UserService, User, UserCreate
app = FastAPI()
class UserService:
def create_user(self):
return 'doing something that creates user'
@brandon-braner
brandon-braner / k8s_cheatsheet.md
Last active December 15, 2022 21:07
Kubernetes Imperative Commands

Create a pod

kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...] [options]

create nginx pod with env vars exposed on port 80

kubectl run nginx-pod --image=nginx --env="DNS_DOMAIN=cluster" --env="SOME_SECRET=secret" --port=80

create python pod and print the version number.

@brandon-braner
brandon-braner / nginx.yaml
Created October 20, 2022 03:00
ngnix ingress service k8
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: hello-kubernetes
labels:
app: hello-kubernetes
spec:
rules:
- http:
paths:
@brandon-braner
brandon-braner / review_notes.md
Created January 22, 2022 03:08
review notes

Nate notes

general notes

  • nice use of HttpException I didn't know that would return a proper error
  • maybe add type hints if we have time
  • no defensive programming around function/method parameters/arguments

files and git

  • Add a readme.md to the root. Mine was a copy and paste of the requirements and a quick blurb of what I implemented.
@brandon-braner
brandon-braner / pyenv_setup.md
Last active December 16, 2021 15:09
Get pyenv working on M1

Tested on M1 Max on MacOS Monterey in Parallels

Install homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install pyenv

brew update brew install pyenv

Add the following to ~/.zprofile