Skip to content

Instantly share code, notes, and snippets.

mostly lurking

Oskar Austegard oaustegard

mostly lurking
View GitHub Profile
oaustegard / CopyAsMarkdown.js
Last active March 15, 2023 17:42
View CopyAsMarkdown.js
(function () {
if (typeof turndownService === 'undefined') {
const script = document.createElement('script');
script.onload = function () {
script.src = '';
} else {
oaustegard /
Created March 6, 2023 04:35 -- an amended version of Simon Willison's wrapper class for easily implementing the new ChatGPT API
# Simon Willison's ChatGPT API Wrapper Class:
# 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 /
Created February 13, 2023 04:26
Clone all Gists
# 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 / 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 / helloworld.html
Last active December 21, 2022 18:48
htmlpreview of gist
View helloworld.html
<html><head><title>Hello from</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(</script>
<p>This html can be rendered by the url
<a href=""
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
>>>import sys
3.10.6 (main, Aug 30 2022, 04:58:14) [Clang 13.1.6 (clang-1316.]
>>> def greet(name):
>>> """ Greets the user by name in an old-fashioned manner """
oaustegard /
Last active December 15, 2022 05:24
@DCWeatherBard is a Twitter account that tweets the DC weather forecast in the
style of an old English poem:
The Weather data is retrieved from the NWS' API and the poem is generated using
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.
oaustegard / mastodon_bookmarklet.js
Last active December 16, 2022 23:19
Tweeps Bookmarklet
View mastodon_bookmarklet.js
/* Bookmarklet generated by GPT-3 when presented with tweeps_bookmarklet.js and the prompt:
change the above bookmarklet to do mastodon searches instead using a function called generate_mastodon_search_links
and the url{url encoded name from selection} */
javascript:(function()%7Bfunction generate_mastodon_search_links() %7Bvar text %3D ""%3Bif (window.getSelection) %7Btext %3D window.getSelection().toString()%3B%7D else if (document.selection %26%26 document.selection.type !%3D "Control") %7Btext %3D document.selection.createRange().text%3B%7Dvar list_elements %3D text.replace(%2F%5B%5Ea-zA-Z%2C %5D%2Fg%2C "").split("%2C")%3Bvar output %3D "<ul>"%3Bfor (var i %3D 0%3B i < list_elements.length%3B i%2B%2B) %7Boutput %2B%3D "<li><a href%3D'" %2B list_elements%5Bi%5D %2B "' target%3D'_blank'>" %2B list_elements%5Bi%5D %2B "<%2Fa><%2Fli>"%3B%7Doutput %2B%3D "<%2Ful>"%3Breturn output%3B%7Dfunction openDiv(html) %7Bvar div %3D docume
oaustegard /
Created September 21, 2022 22:41
# %% Simply prepend each line of the input with '> ' to mark it as a quote in markdown
import klembord
text = klembord.get_text()
output = ''.join(f'> {line}' + '\n' for line in text.splitlines())
# %%
oaustegard / EpicIssuesPriority.js
Last active July 27, 2022 21:15
Jira Epic Child Issues Priority Bookmarklet
View EpicIssuesPriority.js
AJS.$(document).ready(function () {
AJS.$('#ghx-issues-in-epic-table tr').each(function () {
var row = this;
var issueKey = AJS.$(this).attr("data-issuekey");
AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function (data) {
var priorityIconUrl = data.fields.priority.iconUrl;
var priorityName =;
var points = data.fields.customfield_10401;
var actions = AJS.$(row).find('td.status');
AJS.$(actions).before('<td class="nav priority"><img src="' + priorityIconUrl + '" title="' + priorityName + '"> ' + points + '</td>');