Skip to content

Instantly share code, notes, and snippets.

View shabegom's full-sized avatar
🔘
clicking buttons

Sam shabegom

🔘
clicking buttons
View GitHub Profile
@shabegom
shabegom / github_actions_leelo_micro.md
Created February 27, 2024 15:05
Building ZMK firmware for leeloo micro v1.1 using Github Actions

The Leeloo v2.1 and Leeloo-Mcro v1.1 use an unreleased power domain handling feature of ZMK. Building the firmware of these keyboards using Github Actions requires some adjustments to the default configuration. The following are the steps I followed to get Github Actions working with the ClicketySplit fork of ZMK.

Initial Setup

Follow the instructions to install ZMK for GitHub Actions. Select Leeloo-Micro as your keyboard when prompted. I had issues with pushing the local repository to github because https authentication has been deprecated. I fixed this by updating .git > config to use SSH connection. I recommend going through the build process once with the defaults to make sure everything is working as expected.

Adjust the github workflow to use ClicketySplit fork

In `.github > workflows > build.yml

@shabegom
shabegom / Tana QuickAdd.js
Last active July 5, 2023 23:33
Scriptable (iOS) Script for running a Tana QuickAdd Shortcut
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: green; icon-glyph: magic;
/*
SETUP INTSTRUCTIONS
0. Install the Tana QuickAdd Shortcut: https://www.icloud.com/shortcuts/74ce7f48d6d5493c8c0ba563c5f040d6
1. In Tana, Create a Node where you'd like quick added nodes to go.
- quick added nodes will appear as children of this one
- I put mine off my workspace root
@shabegom
shabegom / update-movie.js
Created November 14, 2021 23:11
update movie
<%*
const files = app.vault.getFiles()
.filter(file => file.path.includes("Movies"))
.filter(file => {
const frontmatter = app.metadataCache.getFileCache(file).frontmatter
if (frontmatter && frontmatter.watched && frontmatter.watched === "N") {
return true
} else {
return false
}
@shabegom
shabegom / imdb.js
Created November 14, 2021 23:04
get movie info from IMDB
<%*
async function imdbSearch() {
const apiKey = $OMDB_API_KEY;
const searchPrompt = await tp.system.prompt("What movie?")
const response = await fetch(
`https://omdbapi.com/?apikey=${apiKey}&s=${searchPrompt}`
).then(res => res.json())
if (response.Search[0]) {
const choice = await tp.system.suggester(choice => `${choice.Title} ${choice.Year}`, response.Search, false, "Choose which Movie")
if (choice) {
@shabegom
shabegom / obsidian-events.js
Created May 1, 2021 16:38
listen to an event in obsidian and clean up the listener onunload
// In this example I'm listening to an event in metadataCache.
class MyPlugin extends Plugin {
private eventRef: EventRef
async onload(): Promise<void> {
this.eventRef = this.app.metadataCache.on("changed", (file: Tfile) => doStuff(file))
}
onunload(): void {
this.app.metadataCache.offref(this.eventRef)
@shabegom
shabegom / obsidian.templater.move-line.js
Created April 28, 2021 15:09 — forked from GitMurf/obsidian.templater.move-line.js
Move the active line of the active file to a chosen file.
<%*
//v1.1: Choose where to move line to in file
//'first' will add to top of file. 'last' will add to bottom of file
let firstOrLastLine = 'last';
//Choose a specific line to move to underneath; overrules firstOrLastLine if true
const bChooseLine = false;
//After moving the line, open the file it was moved to
@shabegom
shabegom / Word Count.md
Last active April 27, 2021 19:10
Templater - Get Word Count

%% add this as a template in your templates folder. Run it by choosing Templater: Insert Template in the command paletter %%

<%* function getWordCount(text) { // This function is from the amazing Better Word Count plugin. You should totally get it! https://github.com/lukeleppan/better-word-count

const spaceDelimitedChars = /A-Za-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A1

window.addEventListener('popstate', e => {
setTimeout(() => {
let pageTitle = document.title
let referencePagesNodelist = document.querySelectorAll(".rm-ref-page-view-title")
let arr = Array.prototype.slice.call(referencePagesNodelist).map(el => el.innerText)
arr.map((title, index) => {
if (pageTitle === title) {
referencePagesNodelist.item(index).closest(".rm-ref-page-view").style.display = "none"
}
})