Skip to content

Instantly share code, notes, and snippets.

@Gordin
Gordin / chatGPT_income_of_person.py
Created December 5, 2022 14:07
When you ask ChatGPT to write a python function to estimate a persons net income, based on the most important social and economic factors
def estimate_net_income(gender: str, race: str, age: int,
education: str, occupation: str,
location: str, experience: int,
sexual_orientation: str,
disability_status: bool,
is_trans: bool,
family_status: str) -> float:
# Set base income to $40,000
income = 40000
@Gordin
Gordin / firestore_rest_api.ts
Last active February 8, 2023 17:40
Uses the REST API instead of the native firestore library to be able to get whole collections in batches, instead of the builtin listDocuments that always loads all documents. This assumes that you are inside a firebase project with an initialized app, otherwise generating the AccesToken won't work
import fetch from 'node-fetch'
import * as app from 'firebase-admin/app'
type ListDocumentResult = ExistingListDocumentResult | EmptyListDocumentResult
type json = any
interface ExistingListDocumentResult extends EmptyListDocumentResult{
fields: Record<string,any>
createTime: string,
updateTime: string