Skip to content

Instantly share code, notes, and snippets.

@selfire1
selfire1 / release.yml
Created November 3, 2021 21:05
Github Action to automate Obsidian releases. Source: [Release your plugin with GitHub Actions | Obsidian Plugin Developer Docs](https://marcus.se.net/obsidian-plugin-docs/publishing/release-your-plugin-with-github-actions)
name: Release Obsidian plugin
on:
push:
tags:
- "*"
env:
PLUGIN_NAME: FINDME # Change this to match the id of your plugin.
@selfire1
selfire1 / obsidian-monthnotes.sh
Last active December 30, 2021 18:03
A script that creates twelve monthly overview notes in Markdown for use in Obsidian
#!/bin/bash
# Author: Joschua
# Gist script link: https://gist.github.com/selfire1/f9ddddedc19a59eb6b3103ab51dec11d
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@selfire1
selfire1 / Append to daily.md
Created February 20, 2022 07:01
Appending to Daily Notes in Obsidian

<%* // Append to Daily var dailyDate = "DATE"; //date of the daily note to append to/create (eg."2022-05-20" or 'tp.file.now("YYYY-MM-DD")' const append = * TEXT; //text to append

const folder = app.vault.getAbstractFileByPath("20 Journals"); if (!tp.file.exists(dailyDate)) { await tp.file.create_new(append,dailyDate, false, folder) } else { const originalContent = await app.vault.read(tp.file.find_tfile(dailyDate));

@selfire1
selfire1 / ✍ Copy to Weekly.md
Created February 27, 2022 13:26
A script for Templater to copy the line to a weekly note. Change the variables to your setup

<%* // Select active line // Source: https://gist.github.com/GitMurf/c52dfef13162d88375975e4eefedf3a7 const editor = app.workspace.activeLeaf.view.editor; const curLineNum = editor.getCursor().line; editor.setSelection({ line: curLineNum, ch: 0 }, { line: curLineNum, ch: editor.getLine(curLineNum).length }); let copiedStr = editor.getSelection(); copiedStr = copiedStr.trim();

// Replace formatting

@selfire1
selfire1 / resize.scpt
Last active March 20, 2022 10:56
An Applescript to resize windows from the command line
on run argv
-- Variables
set _cmd to (item 1 of argv)
tell application "Finder" to set _bounds to bounds of window of desktop
set _xPos to (item 1 of _bounds)
set _yPos to (item 2 of _bounds)
set _ySize to (item 3 of _bounds)
set _xSize to (item 4 of _bounds)
-- get bounds
-- do split: app1, app2, set split
@selfire1
selfire1 / add-book-template.md
Last active July 11, 2022 20:58
A template for Obsidian.md to fetch book data from the Google Book API.

// Author: Joschua // Original gist: https://gist.github.com/selfire1/bd1ebf8fd5af629f45a43cef99623236

// Set the amount of search results to fetch maxResults = 3 // Opens a dialogue for book to search for bookQuery = await tp.system.prompt("Enter book to search for 📚🔎");

// Calls the Google Book API to fetch book data

@selfire1
selfire1 / marvin-toggl-tracking.sh
Created June 17, 2021 09:52
A shell script to start tracking an Amazing Marvin task in Toggl Track.
#!/bin/bash
# -------------------------------------------------
# Before running the script, make sure that you understand it. Running code you find on the Internet may damage your system.
# -------------------------------------------------
# In Amazing marvin, set the path to this script as "Start time tracking task" in the "System Triggers strategy" like this:
# /Path/to/this/script $TASK_TITLE
# Replace "YourSecretToken" with your Toggl API token below.
# -------------------------------------------------
curl -v -u YourSecretToken:api_token \

2022

Daily Journaling

const dayInMonth = moment().format("D");
const currentMonth = moment().format("M");
var i = 1;
while (currentMonth > i) {
    var entries = entriesSum(i);
    var max = daysInMonth(i);
    var perc = entries + "/" + max;
@selfire1
selfire1 / bibleverse-formatting.css
Created May 26, 2021 20:53
bibleverse-formatting.css
/* Formatting for Bible verses (h6 headers) in Obsidian */
.markdown-preview-view h6,
.cc-pretty-preview .markdown-preview-view h6
{
position: relative;
left: -4%;
top: 18px;
line-height: 0px;
margin-top: -20px;
margin-right: 3px;
@selfire1
selfire1 / Copy to clipboard.md
Last active December 20, 2022 14:36
Template for the Templater Obsidian plugin to copy current Obsidian note as markdown link

<%* const title = tp.file.title; const uri = 'obsidian://open?vault=Vault&file=' + encodeURI(title); const fullstring = '[' + title + ']' + '(' + uri + ')'; navigator.clipboard.writeText(fullstring); %>