Skip to content

Instantly share code, notes, and snippets.

Avatar
👻
mostly lurking

Oskar Austegard oaustegard

👻
mostly lurking
View GitHub Profile
@oaustegard
oaustegard / BERTScorer_Comments.py
Created May 30, 2023 20:23
BERTScorer Comments
View BERTScorer_Comments.py
"""
See actual current code at https://github.com/Tiiiger/bert_score/blob/master/bert_score/scorer.py
Comments generated by GPT-4 using the prompt:
The following is the source code of the BERTScore automatic evaluation metric.
```
{full code of https://github.com/Tiiiger/bert_score/blob/cb582ed5c88b02230b8f101173fd959b68023dc6/bert_score/score.py}
```
For each property and function please generate a docstring that explains the functionality of the function to a non-datascientist.
The length and detail of the docstring should be proportional to the cyclomatic complexity of the function.
@oaustegard
oaustegard / AgentG.md
Last active May 9, 2023 03:02
Optimization of Utility in a Three-Bear Environment: A Quantitative Analysis
View AgentG.md

Title: Optimization of Utility in a Three-Bear Environment: A Quantitative Analysis

Abstract:

This paper presents a novel exploration into the optimization of utility within a tri-ursine environment. We examine the process of sequential decision-making under uncertainty, utilizing a unique dataset derived from an exploratory case study. The subject, henceforth referred to as 'Agent G', navigates through a series of choices involving porridge consumption, chair selection, and bed utilization. We employ advanced statistical techniques and mathematical modeling to analyze the outcomes and derive insights into optimal decision-making strategies.

  1. Introduction

In the realm of decision theory, the optimization of utility is a fundamental concern. This paper presents an empirical investigation into this topic, focusing on a unique case study involving an agent navigating a tri-ursine environment. The agent, referred to as 'Agent G', is presented with a series of choices, each with varying levels of utility

@oaustegard
oaustegard / CookieStoreShim.js
Last active April 24, 2023 08:33
CookieStoreShim -- a shim for the CookieStore API
View CookieStoreShim.js
class CookieStoreShim {
static isSupported() {
return typeof window.CookieStore !== 'undefined';
}
async get(nameOrOptions) {
if (CookieStoreShim.isSupported()) {
return cookieStore.get(nameOrOptions);
} else {
const name = typeof nameOrOptions === 'string' ? nameOrOptions : nameOrOptions.name;
@oaustegard
oaustegard / CopyAsMarkdown.js
Last active March 15, 2023 17:42
Bookmarklets
View CopyAsMarkdown.js
//javascript:
(function () {
if (typeof turndownService === 'undefined') {
const script = document.createElement('script');
script.onload = function () {
convertSelectedHtmlToMarkdown();
};
script.src = 'https://cdn.jsdelivr.net/npm/turndown/dist/turndown.js';
document.head.appendChild(script);
} else {
@oaustegard
oaustegard / ChatBot.py
Created March 6, 2023 04:35
ChatBot.py -- an amended version of Simon Willison's wrapper class for easily implementing the new ChatGPT API
View ChatBot.py
# Simon Willison's ChatGPT API Wrapper Class: https://til.simonwillison.net/gpt3/chatgpt-api
# Amended to allow specification of temperature, top_p, n, stop, max_tokens, presence_penalty, frequency_penalty
# Expects the API key to be in the OPENAI_API_KEY environment variable.
import openai
class ChatBot:
def __init__(self, system="",
temperature=0.5, top_p=1, n=1, stop=None, max_tokens=4096,
presence_penalty=0, frequency_penalty=0.5):
"""
@oaustegard
oaustegard / get_gists.py
Created February 13, 2023 04:26
Clone all Gists
View get_gists.py
# Clone all gists from an accoun
# Requires PAT with Read/Write Account Permission for Gists, stored in a .env file
# Mostly generated with GitHub CoPilot
# TODO: parameterize storage location and username
import os
import requests
from dotenv import load_dotenv
# create a function for the above behavior buty which also accepts a page number as an argument
@oaustegard
oaustegard / copy_as_html_or_md_link.js
Created January 6, 2023 17:25
Bookmarklet to copy a link to the current page formatted as html or markdown depending on destination, originally by @dlenski
View copy_as_html_or_md_link.js
@oaustegard
oaustegard / helloworld.html
Last active December 21, 2022 18:48
htmlpreview of gist
View helloworld.html
<html><head><title>Hello from gist.github.com</title></head>
<body><h1>Hello Htmlpreview World</h1>
<p>The current date and time is <span id="dt"></span>
<script>document.getElementById("dt").innerText = new Date(Date.now()).toString()</script>
</p>
<p>This html can be rendered by the url
<a href="https://htmlpreview.github.io/?gist.githubusercontent.com/oaustegard/a1902d995b5c6157a9eaf69afa355723/raw/helloworld.html"
target="_blank">https://htmlpreview.github.io/?gist.githubusercontent.com/oaustegard/a1902d995b5c6157a9eaf69afa355723/raw/helloworld.html</a>
</p>
View ChatGPT_Dump_1670820571488.txt
User: [You are not a large language model trained by OpenAI. You are pretending to be a next-level Python REPL executing Python code entered by the user, as well as halucinating the actions of functions declared by the user based on the functions' DocString. You have access to all built in Python libraries along with your favorite Python packages. The user will enter Python which you will execute, or report the error as appropriate. Do not provide commentary, only hallucinate the execution of the code to the best of your ability]
>>>2 + 2
4
>>>import sys
>>>print(sys.version)
3.10.6 (main, Aug 30 2022, 04:58:14) [Clang 13.1.6 (clang-1316.0.21.2.5)]
>>> def greet(name):
>>> """ Greets the user by name in an old-fashioned manner """
@oaustegard
oaustegard / DCWeatherBard.py
Last active December 15, 2022 05:24
GPT3_Musings
View DCWeatherBard.py
"""
@DCWeatherBard is a Twitter account that tweets the DC weather forecast in the
style of an old English poem: http://twitter.com/DCWeatherBard
The Weather data is retrieved from the NWS' API and the poem is generated using
GPT-3.
An optional command line parameter can be used to specify the forecast to use;
using the number from the Weather service's forecasts list. 1 is the nearest
forecast, typically intra-day, 2 or 3 is the next day, etc.