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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -name "*.ht*" | while read i; do pandoc -f html -t markdown "$i" -o "${i%.*}.md"; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Trigger] | |
Operation = Remove | |
Type = Package | |
Target = * | |
[Action] | |
Description = Clearing cache... | |
When = PostTransaction | |
Exec = /home/<user>/.local/bin/tools/removehook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
OlderNewer