Skip to content

Instantly share code, notes, and snippets.

View alangrainger's full-sized avatar

Alan Grainger alangrainger

View GitHub Profile
@alangrainger
alangrainger / theme.css
Last active February 17, 2025 13:36
SilverBullet theme Obsidian-ish
html {
--editor-font: "Inter";
}
.cm-line {
font-size: 12pt;
}
/* Code blocks */
.sb-line-fenced-code {
@alangrainger
alangrainger / mount-folders.sh
Created December 27, 2024 02:25
Synology NAS, mount multiple encrypted folders
#!/bin/bash
# To make your life easier, add synoshare to /etc/sudoers
# your_user_account ALL=(ALL) NOPASSWD: /usr/syno/sbin/synoshare
shares=(
"Some folder"
"Another shared folder"
"blah_blah"
)
@alangrainger
alangrainger / Copy direct link to Gmail email.md
Last active April 12, 2025 17:28
Copy a direct link to a Gmail email to your clipboard
@alangrainger
alangrainger / trip-calendar.js
Last active February 5, 2023 05:55
Obsidian event calendar
/*
I created this Dataview script to turn a list of events into a nice visual calendar representation.
Alternatively you can provide YAML start-date and end-date field names, and the script will find all
matching notes and display those as events.
Step 1:
Add a list to a note in this format:
- 2022-09-05 to 2022-09-16 | Conference in Houston
- 2022-10-04 to 2022-10-11 | [[Holiday in Bali]] | (this one is a link to a page)
@alangrainger
alangrainger / getGooglePhoto.js
Last active November 4, 2022 11:12
Insert a personal Google Photo into an Obsidian entry, either as a link, a remote image, or a locally stored thumbnail
<%*
// You can create any number of resolution options that you want to select from
const resolutions = [
{
name: 'Thumbnail', // A friendly name
res: [350, 250] // Width by height. The image will maintain aspect ratio
},
{
name: 'Large',
res: [1280, 720]
@alangrainger
alangrainger / ____script_ Review old notes.js
Last active September 24, 2024 00:20
Templater script for Obsidian, to find and review old notes
<%*
/* === Installation ===
*
* 1. Make sure you have both Templater and Dataview installed.
* 2. Create a new template note.
* 3. Copy and paste the full code from this file you're reading.
* 4. Launch the script by using the Templater command "Open Insert Template modal".
* 5. Optional, assign this script to a hotkey using the Templater settings page.
*
* v1.0.4
@alangrainger
alangrainger / mlo.ahk
Last active June 23, 2021 04:37
Fix MLO broken Ctrl+Backspace
; Fix the broken Ctrl+Backspace in MyLifeOrganized using Autohotkey
#IfWinActive, ahk_exe mlo.exe
^Backspace::
Send ^+{Left}{Backspace}
return
#IfWinActive
@alangrainger
alangrainger / readme.md
Created July 5, 2020 20:38
DataDog colourblind CSS

Add this custom CSS however you prefer (Stylus is easy), and change the colour value here to whatever you want your success colour to be.

body {
  --ui-status-success: rgb(32, 156, 238) !important;
}
@alangrainger
alangrainger / clickup-rambox-unread-badge.js
Created June 10, 2020 23:07
Add an unread badge count to ClickUp when using as a custom service in Rambox
/*
Add this into the Custom Code section in your custom service:
https://github.com/ramboxapp/community-edition/wiki/Add-a-Custom-Service
*/
function checkUnread() {
// Check for an unread count by looking for the dot favicon
var unread = document.querySelectorAll("link[href^='favicon-dot-32x32']")
// Get the document title
@alangrainger
alangrainger / gist:d58d2011257ff0de7f39a0320f59848f
Last active July 7, 2020 01:21
Formula for calculating NZ Income Tax / PAYE on monthly income. Works for Excel or Google Sheets.
=IF(E2<=1166.67,SUM(E2*10.5%),IF(E2<=4000,SUM(E2-1166.67)*17.5%+122.5,IF(E2<=5833.33,SUM(E2-4000)*30%+618.33,SUM(E2-5833.33)*33%+1168.33)))