Skip to content

Instantly share code, notes, and snippets.

@pbinkley
pbinkley / weekly.py
Last active January 21, 2025 00:50
Python script to generate a weekly note for Obsidian, with embedded Google Calendars for each day and inclusion of Obsidian tasks using dataview plug-in
import datetime
from string import Template
import os.path
# create Weekly Notes file for current week
# - replaces the Periodic Notes plugin, which stopped working
# correctly for me in Jan. 2025 (it kept using the year 2024)
# - to run: open terminal, cd to "Obsidian environment/Scripts",
# run "python3 weekly.py"
@RhetTbull
RhetTbull / resolve_macos_alias.py
Last active October 22, 2024 03:11
Resolve macOS alias path in Python
"""Resolve path to macOS alias file
Given a path to a file that is a macOS alias, resolve the path to the original file
Requires: pip install pyobjc-core
"""
from Foundation import (
NSURL,
NSData,
@RhetTbull
RhetTbull / resolve_macos_alias_path.py
Created May 27, 2024 00:21
Resolve path to original file pointed to by macOS alias
"""Resolve path to original file pointed to by macOS alias
To use:
pip install pyobjc-core
python3 resolve_macos_alias_path.py /path/to/alias
"""
from Foundation import (
NSURL,

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
hs.hotkey.bind({}, "§", function() hs.eventtap.keyStroke({}, "`") end )
hs.hotkey.bind({ "cmd" }, "§", function() hs.eventtap.keyStroke({ "cmd" }, "`") end )
hs.hotkey.bind({ "shift" }, "§", function() hs.eventtap.keyStroke({ "shift" }, "`") end )
hs.hotkey.bind({ "cmd", "shift" }, "§", function() hs.eventtap.keyStroke({ "cmd", "shift" }, "`") end )
@mathix420
mathix420 / medium.user.js
Last active April 21, 2025 14:09
Bypass Medium Paywall - Working late 2023 - Greasy Fork, Violentmonkey, Tampermonkey - Click the RAW button to install
// ==UserScript==
// @name Medium Paywall Bypass
// @namespace Violentmonkey Scripts
// @run-at document-start
// @match *://*.medium.com/*
// @match *://medium.com/*
// @match *://*/*
// @grant none
// @version 2.4
// @inject-into content
@flegfleg
flegfleg / Logseq+Hookmark.scpt
Last active October 30, 2024 09:39
Logseq Hookmark integration Applescript
-- Logseq Hookmark integration via Applescript
-- Copies Links to pages only, not blocks.
-- Paste this into Hook -> Preferences -> Scripts -> Logseq -> Get Address
tell application "System Events"
set the clipboard to ""
delay 0.5
-- You need to set a keyboard shortcut for "Copy page Url" in Logseq
-- Here: CMD + CTRL + SHIFT + U
@chrisgrieser
chrisgrieser / metadata-refactor.sh
Last active May 11, 2024 05:54
Change Wikilinks in YAML Frontmatter from the Breadcrumbs style to the new Obsidian Metadata Style
# macOS
cd "path/to/your/vault"
awk 'FNR <= 1 && /^---$/{print FILENAME}' **/*.md |
xargs -I {} sed -i '' -E '1,/^---$/ s/(\[\[.*]])/"\1"/g' "{}"
# Linux (or macOS users with GNU sed)
cd "path/to/your/vault"
awk 'FNR <= 1 && /^---$/{print FILENAME}' **/*.md |
xargs -I {} sed -i -E '1,/^---$/ s/(\[\[.*]])/"\1"/g' "{}"
## Tab Manager In Side Panel Privacy Disclaimer
This extension only collect some personal or sensitive data from your browser activity, such as the URLs or domains you visit.
We collect this data to provide you with the functionality of our extension: a simple but powerful tab manager in side panel for chrome.
We do not sell, share or disclose your data to any third parties.
We only use your data locally and only for as long as necessary to provide our service.
@extratone
extratone / ddstuff.json
Created March 14, 2023 21:13
A gray-er light theme (for Drafts) inspired by Things 3's light appearance with certain taken liberties.
{
"isDark" : false,
"author" : "David Blue",
"colors" : {
"editor" : {
"codeBackground" : "#f2f3f4",
"headingMarkup" : "#a2a3a6",
"accent02" : "#cdc080",
"link" : "#5281b1",
"code" : "#5f6165",