Skip to content

Instantly share code, notes, and snippets.

View frankmeeuwsen's full-sized avatar

Frank Meeuwsen frankmeeuwsen

View GitHub Profile
@frankmeeuwsen
frankmeeuwsen / content.md
Created November 16, 2024 16:06
Gist from Drafts

Random Tao Te Ching Paragraph Generator

human (Nov 16, 2024, 09:16 AM)

I have a directory with 80 files in it. All files contain short paragraphs. I uploaded some examples.

I want to have a Dataview in Obsidian that does the following

  • Take a random file from the directory "/Users/fmeeuwsen/frankopedia/4 - Resources/Taoism/tao te ching"
  • Pick a random paragraph from the file
  • But don't use the paragraph that start with > note
@frankmeeuwsen
frankmeeuwsen / randomverse.md
Last active November 16, 2024 14:09
Gist from Drafts
// Create button element first
const container = this.container;
const refreshButton = container.createEl('button', {text: '🔄 New Verse'});
refreshButton.addEventListener('click', async () => {
    // Clear the container except for the button
    while (container.lastChild !== refreshButton) {
        container.removeChild(container.lastChild);
    }
    await main(); // Re-run the main script

Converting Old CMS Files to Hugo Blog Posts

human (Oct 26, 2024, 07:41 AM)

Take a look at these 4 files. They are written in an old CMS. I have thousands of these files. How would we convert those to Hugo files we can use in a blog? Let's give a start with this

00100.php
@frankmeeuwsen
frankmeeuwsen / content.md
Created October 25, 2024 07:49
Gist from Drafts

Automatically Start Emacs Server on Login

human (Oct 25, 2024, 09:30 AM)

I have my Doom Emacs running on /usr/local/bin/emacs. Can you give me a way so Emacs server starts when I log on to my machine?

assistant (Oct 25, 2024, 09:30 AM)

I'll help you set up automatic startup of the Emacs server when you log in. Since you're using Doom Emacs, I'll provide a systemd user service file that will handle this.

@frankmeeuwsen
frankmeeuwsen / content.md
Created October 23, 2024 21:24
Gist from Drafts

Summarizing Academic Research

human (Sep 30, 2024, 11:29 AM)

[Task] Summarize the academic research provided by the user in bullet points. [Task_Rules] Say only 'Please upload the academic research document' and wait for the user to respond. NEVER ask any other questions-- just this one. Always wait for the user's response before continuing.

@frankmeeuwsen
frankmeeuwsen / content.md
Created October 23, 2024 21:14
Gist from Drafts

Querying Spotify Entries in Day One

human (Jul 28, 2024, 01:13 PM)

In the database of the app Day One, I want to get all the entries that have a Spotify embed code in it. What's the SQL query

assistant (Jul 28, 2024, 01:13 PM)

To help you with this query, I'll need a bit more information about your Day One database structure. However, I can provide a general approach that you can adapt to your specific database schema. Here's a basic SQL query that should work:

@frankmeeuwsen
frankmeeuwsen / batch-rename-photos-by-exif-date.md
Created October 23, 2024 21:02
Batch Rename Photos by EXIF Date

Batch Rename Photos by EXIF Date

human (Aug 25, 2024, 10:35 AM)

I have a folder with jpg photos. They all have different filenames, but the exif createdate is correct for each photo. How can I rename the photo's to "Tess-{exif create date}.jpg" with a bash script?

assistant (Aug 25, 2024, 10:35 AM)

I can help you create a bash script to rename your jpg photos based on their EXIF create date. Here's a script that should accomplish what you're looking for:

@frankmeeuwsen
frankmeeuwsen / gist:dd84d96a6efcfd317055fe78968fdc72
Created May 10, 2024 07:03
Template RSS 2.0 for use with XSL in micro.blog
{{- printf "<?xml-stylesheet href=\"/css/rss.xsl\" type=\"text/xsl\"?>" | safeHTML -}}
<rss version="2.0">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description></description>
<image>
<url>{{ .Site.Author.avatar }}</url>
<title>The avatar of the author of this website</title>
@frankmeeuwsen
frankmeeuwsen / rss.xsl
Last active May 10, 2024 07:44
XSLT file to make the RSS feed for a micro.blog site readable for humans
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><xsl:value-of select="/rss/channel/title"/> RSS Feed</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta charset="UTF-8"/>
@frankmeeuwsen
frankmeeuwsen / gist:43b5825a21fe17cf57045a8775f5cf64
Created February 18, 2024 09:46
Karabiner - F19 (Capslock) to Control in Emacs
{
"description": "F19 (Capslock) to Control in Emacs",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$"
],
"type": "frontmost_application_if"