Skip to content

Instantly share code, notes, and snippets.

@regexyl
Last active March 31, 2022 10:13
Show Gist options
  • Save regexyl/06e435bceaf914567114f16bc66b0616 to your computer and use it in GitHub Desktop.
Save regexyl/06e435bceaf914567114f16bc66b0616 to your computer and use it in GitHub Desktop.
TIL snippets in point form. This is the very first TIL note! Planning to do 1 TIL.md per month.

TIL - March 2022

31 Mar 2022

  • re: Obsidian scheduled backups - Tried to get launchd to work via plist at ~/Library/LaunchAgents/com.gilite-notes.notes.plist, but it didn't have enough permissions to access the Node files at /usr/local/bin/node.
    • Originally preferred launchd over cron since it allows the job to run right after the computer wakes from sleeping, if the job was supposed to run but the computer was in sleep mode.
    • Also attempted moving the plist to ~/Library/LaunchDaemons/ so that the job can be executed even if I'm logged out, but the same error as above occurred.
    • cron worked after a few tries, incl. setting the git config to replace https://github.com/ with git@github.com: since one of the errors specified fatal: could not read Username for 'https://github.com': No such file or directory. (see this)
    • To get over the same error with launchd, grant cron 'Full Disk Access' at Security & Privacy in macOS.
    • The cronjob can be edited via crontab -e, while list of cronjobs can be outputed via crontab -l. Cronjob outputs can be viewed with mail.
  • re: UPDATE on ^ - Got launchd to work! The issue was the same; enable 'Full Disk Access' for launchctl
    • Remember to execute the following load and unload commands every time you make a change to the plist file:
      • launchctl unload ~/Library/LaunchAgents/com.gilite-notes.notes.plist
      • launchctl load ~/Library/LaunchAgents/com.gilite-notes.notes.plist
    • Test the plist file by manually triggering it:
      • launchctl start com.gilite-notes.notes
    • Check if the plist file is valid:
      • plutil ~/Library/LaunchAgents/com.gilite-notes.notes.plist

30 Mar 2022

  • There's a collection of OSS on Code Shelter for volunteer devs to adopt projects as maintainers.

29 Mar 2022

Whoops skipped TIL for this day

28 Mar 2022

  • Using process.exit([number]) is not recommended practice due to the possibility of abrupt exits on executed async fucntions. Use process.exitCode([number]) instead. ^
  • echo $? returns the exit status of last command. ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment