Skip to content

Instantly share code, notes, and snippets.

View brsma's full-sized avatar

Sascha Brossmann brsma

View GitHub Profile
# /// script
# dependencies = [ "transformers", "accelerate" ]
# ///
# run on 2xH200 rented from primeintellect.ai
import gc
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
@scriptingosx
scriptingosx / getDefaultAppForURL.sh
Created August 18, 2023 12:36
two scripts to set and read default app for url schemes (http, mailto, ssh, etc.) for use with Jamf Pro
#!/bin/bash
# this script will return the current default application for a url scheme
# for use as a Jamf Extension attribute
# by Armin Briegel - Scripting OS X
# Permission is granted to use this code in any way you want.
# Credit would be nice, but not obligatory.
# Provided "as is", without warranty of any kind, express or implied.
/* See Tweet thread for info on the use of this file: https://twitter.com/TfTHacker/status/1588781787865808897?s=20&t=iDq6L-u4SHnJ5UfN0r7yzQ */
/* I am not a CSS dude, so no promises this is well written CSS */
.nav-folder-title {
font-weight: 600 !important;
color:steelblue;
}
[data-path="Teaching"] > .nav-folder-title-content::before {
@Azurewren
Azurewren / Automated Periodic Note Creation.md
Last active November 2, 2025 07:11
Automated Periodic Note Creation

This is a Templater Startup Script for use in Obsidian.

Each time Obsidian is opened, Templater runs the script to see if a weekly, monthly, quarterly, and yearly file exists for the current date. If one exists, it moves on, if not, it creates the file using the appropriate template, in the appropriate place.

<%*
let wk = tp.date.now('GGGG-[W]WW');
let mnth = tp.date.now('MM MMMM');
let qrtr = tp.date.now('Qo [Quarter]');
let yr = tp.date.now('YYYY');
@renatocaliari
renatocaliari / logseq-query-overdue
Last active December 7, 2023 01:12
logseq query for overdue blocks
{:title [:h3 "🔥 Overdue"]
:query [:find (pull ?block [*])
:in $ ?start ?next
:where
(or-join [?block, ?d]
[?block :block/scheduled ?d]
[?block :block/deadline ?d]
(and
[?block :block/ref-pages ?rp]
[?rp :block/journal-day ?d]
@jsliang
jsliang / yearlyMoc.js
Last active June 26, 2025 22:35
Yearly MOC Generator - Obsidian Templater User Script
/**
* @author Jui-Shan (Jenny) Liang <[email protected]>
* @param {Object} tp the `tp` object of the Templater plugin
* @param {Object} options options for configuring the year to generate the MOC and the file name format
* @param {string} options.YEAR what year to generate the MOC; default to the current year
* @param {string} options.YEARLY_FORMAT filename format of yearly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.QUARTER_FORMAT filename format of quarterly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.MONTH_FORMAT filename format of monthly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.WEEK_FORMAT filename format of weekly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.DAY_FORMAT filename format of daily notes; format reference: https://momentjs.com/docs/#/displaying/format/
@TfTHacker
TfTHacker / FastStart-StartupScript.js
Last active February 9, 2025 10:33
FastStart Script for Obsidian - makes it easy to delay the startup of plugins
<%*
fastStart = async (filename, delayInSecond) => {
if (tp.file.exists(filename)) {
const f = tp.file.find_tfile(filename);
let plugins = (await app.vault.read(f)).split(/\r?\n/);
setTimeout(async () => {
plugins.forEach(async (p) => await app.plugins.enablePlugin(p))
}, delayInSecond * 1000)
}
}
@GitMurf
GitMurf / obsidian.live-preview.css.block-ref-inline.css
Last active October 27, 2025 08:27
CSS for inline block references that works for both NEW CM6 Live Preview and also Preview Mode for both CM5 (Legacy) and CM6 (New)
:root {
/* #7159de (similar to Obsidian purple) */
--block-ref-line-color: grey;
--block-ref-line-type: solid;
--block-ref-line-size: 2px;
/* Set to "inherit" for no bg color */
--block-ref-hover-bg-color: #d4d0d026;
}
/*
@TfTHacker
TfTHacker / ArchiveAndProcessNextFile.js
Last active April 5, 2025 06:41
Obsidian: Archive current file and then open next file in folder (Templater script)
<%*
/*
Updated: 9/20/2022
Author: TfTHacker
Gist: https://gist.github.com/TfTHacker
Twitter: https://twitter.com/TfTHacker
Requirements: Templater Plugin for Obsidian
Description: This script performs the following actions:
1. Moves current file to the archive folder (defined in the variable archivePath)
if archivePath is null, a folders in the vault will be presented for selection
```dataviewjs
// find dates based on format [[YYYY-MM-DD]]
const findDated = (task)=>{
if( !task.completed ) {
task.link = " " + "[[" + task.path + "|*]]";
task.date="";
const found = task.text.match(/\[\[([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))\]\]/);
if(found) task.date = moment(found[1]);
return true;
}