Skip to content

Instantly share code, notes, and snippets.

View alangrainger's full-sized avatar

Alan Grainger alangrainger

View GitHub Profile
@alangrainger
alangrainger / Copy direct link to Gmail email.md
Last active October 17, 2024 05:31
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)))
@alangrainger
alangrainger / keybase.md
Last active September 7, 2019 08:03
keybase.md

Keybase proof

I hereby claim:

  • I am alangrainger on github.
  • I am alan_ (https://keybase.io/alan_) on keybase.
  • I have a public key ASCAG1R7ChZGELoMqd3l_rSOtAosrnIYgvSnFh2xbMC4awo

To claim this, I am signing this object:

@alangrainger
alangrainger / okex.php
Created May 8, 2019 09:58
Signed OKEX requests with CURL and PHP
$time = round(microtime(true), 3);
$method = strtoupper($method);
$string = $time . $method . $endpoint;
$hash = hash_hmac('sha256', $string, $secret);
$hash = base64_encode(hex2bin($hash));
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://www.okex.com' . $endpoint,