Skip to content

Instantly share code, notes, and snippets.

@Maxr1998
Maxr1998 / todoist-cleaner.py
Last active February 21, 2023 13:18
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)
@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 August 22, 2023 19:55
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
@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
@juxuanu
juxuanu / auto-protonvpn.md
Last active January 12, 2024 09:22
Systemd user service to autoconnect to ProtonVPN through their the CLI utility

Service definition: ~/.config/systemd/user/auto-protonvpn.service

[Unit]
Description=ProtonVPN Connection
After=network-online.target
BindsTo=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/bin/protonvpn-cli ks --off ; /usr/bin/protonvpn-cli connect -f
```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;
}
@bzerangue
bzerangue / html2md-with-pandoc.sh
Created April 26, 2012 23:14
RECURSIVELY Bash convert all your html to markdown files (with Pandoc)
find . -name "*.ht*" | while read i; do pandoc -f html -t markdown "$i" -o "${i%.*}.md"; done
@jsliang
jsliang / yearlyMoc.js
Last active February 13, 2024 12:22
Yearly MOC Generator - Obsidian Templater User Script
/**
* @author Jui-Shan (Jenny) Liang <jsliang.tw@gmail.com>
* @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/
@luukvbaal
luukvbaal / cacheremove.hook
Last active February 20, 2024 01:52
yay paccache hooks
[Trigger]
Operation = Remove
Type = Package
Target = *
[Action]
Description = Clearing cache...
When = PostTransaction
Exec = /home/<user>/.local/bin/tools/removehook
# sdkman recommands settings SDKMAN_DIR and sourcing sdkman-init.sh
# this can really slow down shell startup, so here's my attempt to lazy-load sdk()
#
# This snippet lives in my ~/.profile but generally could live in any zsh-related startup file.
#
# the logic of this custom sdk is kind of odd, but it basically checks if the current
# definition of sdk() is too short (less than 10 lines). If so, it tries to source
# the init script and then pass through all the arguments to the real sdk function.
export SDKMAN_DIR="$HOME/.sdkman"