Skip to content

Instantly share code, notes, and snippets.

View doitian's full-sized avatar

ian doitian

View GitHub Profile
This file has been truncated, but you can view the full file.
"use strict";
var obsidian = require("obsidian");
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
# Start Python REPL and setup rich
if command -v python3 &>/dev/null; then
import base64
from Crypto.Hash import SHA256
from Crypto.PublicKey import ECC
from Crypto.Signature import DSS
from Crypto.Util.asn1 import DerSequence
response = {
"signature": "MEUCICF25qdO6nLreEoBHnyaw-9R6XFHbIu-NwsAI53t016qAiEAgmhlwTEMxoWx"
"openrpc": "1.0.0-rc1",
"info": {
"version": "1.0.0",
"title": "Petstore",
"license": {
"name": "MIT"
"servers": [
doitian / settings.json
Created September 1, 2023 02:38
vscode settings
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
doitian / input.js
Last active August 11, 2023 03:31
Obisidian CustomJS module to ask for user input
class Input {
PromptModal = class extends customJS.obsidian.Modal {
title = "Input";
value = "";
submitted = false;
placeholder = "Type text here";
constructor(opts = {}) {
Object.assign(this, opts);
doitian / config.yml
Last active August 10, 2023 12:57
Open history version files from Git in Vim via LazyGit
# yaml-language-server: $schema=
promptToReturnFromSubprocess: false
editPreset: "nvim"
- key: E
context: commitFiles
subprocess: true
# - When a file is selected, open the file before the commit
#!/usr/bin/env python3
import os
import re
import sys
import subprocess
import json
from collections import namedtuple, OrderedDict
import requests
from requests.auth import HTTPBasicAuth
doitian / ifttt-google-calendar-to-discord-webhook-filter.ts
Created March 23, 2023 13:24
Send Google Calendar events to Discord via Webhook
function htmlToMarkdown(input: string) {
const linkRegex = /<a\s+[^>]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi;
return input.replace(linkRegex, '[$2]($1)');
const TZ = 8*60*60;
function formatDiscordTimestamp(input: string) {
const ts = moment.utc(input, "MMMM D, YYYY at hh:mmA", "MMMM D, YYYY").unix() - TZ;
return `<t:${ts}>`;
doitian / ai-git-commit
Last active March 7, 2023 13:21
Git commit with OpenAI generated message based on
if [ -z "${OPENAI_API_KEY:-}" ]; then
export OPENAI_API_KEY="$(gopass show key/"
system_message="You are a helpful assistant who writes short git commit messages."
user_message="Write the commit message for the following changes:
$(git diff --cached)"