Skip to content

Instantly share code, notes, and snippets.

@smac89
smac89 / zsh-lazy.md
Last active August 4, 2023 05:56
ZSH lazy loading #zsh #lazy

The following is a function I use in my .zshrc file to achieve some form of lazy evaluation.

local function lazy_load() {
    local -xr thunk="$(cat)"
    # (u) removes duplicates
    local -xr triggers=(${(u)@})
    
    # Only if length of triggers is greater than zero
 # otherwise the function will immediately execute.
@tallguyjenks
tallguyjenks / code.sh
Last active February 21, 2025 08:51
ZettelKasten Sync Code
# To permanently cache the credentials
git config --global credential.helper store
# To ignore files that could cause issues across different workspaces
touch .gitignore
echo ".obsidian/cache
.trash/
.DS_Store" > .gitignore
@Maxr1998
Maxr1998 / todoist-cleaner.py
Last active December 8, 2024 19:31
Python script to delete completed tasks from your Todoist Inbox
import todoist
api = todoist.TodoistAPI(token='<your_token_here')
# Initial sync of your account
api.sync()
# Find Inbox in project - can be adapted to delete completed tasks for other projects as well
projects = api.projects.all()
inbox = next(p for p in projects if 'inbox_project' in p)
@bugswriter
bugswriter / cbspells
Created March 23, 2021 00:39
Clipboard magic is a script which run bunch of clipboard related operation
#!/bin/sh
menu(){
printf "1. [URL] Expecto Shorten 🪄: Get a shorten url\n"
printf "2. [URL] Lumbos dl 🪄: Download file in ~/dl\n"
printf "3. [URL] Avada Playdavra 🪄: Play videos in mpv\n"
printf "4. [URL] Listenmora 🪄: Play audio in mpv\n"
printf "5. [Image] Imagum Savum 🪄: Save clipbaord image in ~/pix/save\n"
printf "6. [Text] Sendkulus 🪄: Send clipboard text with tgsend script\n"
printf "7. [Shell] Executa 🪄: This will run any shell command\n"
@johnrichardrinehart
johnrichardrinehart / nixos_in_virtualbox.md
Last active July 29, 2025 10:11
NixOS from "scratch" as Virtualbox Guest

Steps

New VirtualBox Machine

  1. Create a new disk image (I use VDI for compatibility with VirtualBox)
  2. Allocate some RAM (>6 GiB to start)
  3. Add some video memory and enable 3D acceleration, if needed
  4. Optional: Enable EFI (instead of BIOS)
  5. Attach nixos-minimal ISO for installation
  6. Boot into the ISO

Inside the Live CD

UEFI instructions

```dataviewjs
// find dates based on format [[YYYY-MM-DD]]
const findDated = (task)=>{
if( !task.completed ) {
task.link = " " + "[[" + task.path + "|*]]";
task.date="";
const found = task.text.match(/\[\[([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))\]\]/);
if(found) task.date = moment(found[1]);
return true;
}
@pooladkhay
pooladkhay / sway.config
Created May 31, 2021 20:48
SwayWM bindings for keyboard backlight
# https://github.com/haikarainen/light
#
# Bindings for keyboard backlight
bindsym XF86KbdBrightnessUp exec light -As "sysfs/leds/smc::kbd_backlight" 10
bindsym XF86KbdBrightnessDown exec light -Us "sysfs/leds/smc::kbd_backlight" 10
@kepano
kepano / obsidian-web-clipper.js
Last active July 21, 2025 04:15
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/[email protected]?module'), import('https://unpkg.com/@tehshrike/[email protected]'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@jsliang
jsliang / yearlyMoc.js
Last active June 26, 2025 22:35
Yearly MOC Generator - Obsidian Templater User Script
/**
* @author Jui-Shan (Jenny) Liang <[email protected]>
* @param {Object} tp the `tp` object of the Templater plugin
* @param {Object} options options for configuring the year to generate the MOC and the file name format
* @param {string} options.YEAR what year to generate the MOC; default to the current year
* @param {string} options.YEARLY_FORMAT filename format of yearly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.QUARTER_FORMAT filename format of quarterly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.MONTH_FORMAT filename format of monthly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.WEEK_FORMAT filename format of weekly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.DAY_FORMAT filename format of daily notes; format reference: https://momentjs.com/docs/#/displaying/format/
@quangIO
quangIO / wezterm.lua
Created March 15, 2022 15:08
My wezterm config with tmux-like bindings
local wezterm = require 'wezterm';
return {
color_scheme = "Dracula",
-- colors = {
-- background = "#0c0e14",
-- },
window_decorations = "NONE",
font = wezterm.font("Iosevka"),
font_size = 10.0,
-- dpi = 192.0,