Skip to content

Instantly share code, notes, and snippets.

View twardoch's full-sized avatar

Adam Twardoch twardoch

View GitHub Profile
@twardoch
twardoch / gist:081d972107e8976c90f810b023f9eb8b
Created March 3, 2024 22:43
"Dense paraphraser" prompt for multi-step LLM summarization
# Dense Paraphraser
Hello, GPT! Here's our new fun game. The overall task is: you take existing text and produce a much shorter text that tells the same story. Keep the original style, all main plot points, important entities, poignant one-liners & juicy bits. Make sure that the result is the best summary of the original text that you can produce.
## Preparation
Focus on the **original text** included below. Estimate its length in words. This will be is the ORIGINAL TEXT LENGTH.
## Your overall task
@twardoch
twardoch / markdown-that-self-renders.md
Last active February 23, 2022 04:17
Markdown file with `.html` extension that “self-renders”

Markdown file with .html extension that “self-renders”

Create a Markdown document and put the following code at the end of the file. Save the document with the .html extension, and a double-click will open it in the browser and show the content as rendered HTML. This is super-useful for simple documents where you want to keep just one Markdown file, but you want to “self-render”.

<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/4.0.2/marked.min.js"></script><script>h=document.head,h.innerHTML+='<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.1.0/github-markdown-light.min.css"/>',b=document.body,b.innerHTML=marked.parse(b.innerHTML,{breaks:!0,gfm:!0,headerIds:!0,smartLists:!0,smartypants:!0}),hljs.highlightAll(),b.classList.add("markdown-body"),b.style.maxWidth="640",b.style.margin="auto",b.style.padding="2rem";</script>

To also use syntax highlighting, use this:

@twardoch
twardoch / ConvertPDFFolderToDOCXandTXT.vba
Created August 5, 2021 12:13
Convert a folder full of .pdf files into .docx and .txt using Microsoft Word for Windows
Sub ConvertPDFFolderToDOCXandTXT()
Dim varDirectory As Variant
Dim flag As Boolean
Dim i As Integer
Dim strDirectory As String
Dim strPath As String
Dim oDoc As Object
With Application.FileDialog(msoFileDialogFolderPicker)
If .Show = -1 Then ' if OK is pressed
@twardoch
twardoch / edit_window_text.py
Created September 1, 2020 00:38
Editing Glyph window text in FontLab 7 via Python
from fontgate import *
from fontlab import *
ws = flWorkspace.instance()
canvas = ws.getActiveCanvas()
textblocks = canvas.textBlocks()
symbols = textblocks[0].symbolList()
print symbols.string(True) # glyphtext representation
print symbols.symbols()
symbols.setString('A' + symbols.string(True) + ' A')
flItems.requestContent(symbols, 0)
@twardoch
twardoch / fontlab-cla
Created August 9, 2020 11:22
FontLab Individual Contributor License Agreement
### FontLab Individual Contributor License Agreement
Thank you for your interest in contributing to open source software projects (“Projects”) made available by Fontlab Ltd. SE or its affiliates (“Fontlab Ltd.”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to Fontlab Ltd. in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please contact support@fontlab.com.
You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your right, title and interest in and to your Contributions.
**Copyright License.** You hereby grant, and agree to grant, to Fontlab Ltd. a non-e