Skip to content

Instantly share code, notes, and snippets.

View shanehull's full-sized avatar
🙃

Shane Hull shanehull

🙃
View GitHub Profile
-- **User command to insert a decision template at the current line** --
vim.api.nvim_create_user_command("Decision", function()
local template = [[
**Mental/physical state:**
- [ ] Energized
- [ ] Focused
- [ ] Relaxed
- [ ] Confident
- [ ] Tired
@shanehull
shanehull / zettelkasten.lua
Last active April 10, 2024 11:25
NeoVim Zettelkasten Command
-- Command to create a new zettelkasten style note in 0-inbox of your second brain
vim.api.nvim_create_user_command("Zet", function()
local directory = os.getenv("SECOND_BRAIN") .. "/0-inbox" or os.getenv("HOME") .. "secondbrain/0-inbox/"
-- Get the file name from the user
local status, result = pcall(function()
Fname = vim.fn.input("File name: ", "", "file")
end)
-- Handle error (e.g. keyboard interrupt)
if not status then
@shanehull
shanehull / IBResampleDataTrace
Last active July 7, 2021 04:31
Trace of issue when resampleing IB data.
--- modulename: autodict, funcname: __getattr__
autodict.py(101): if key.startswith('_'):
autodict.py(104): return self[key]
dataseries.py(185): return o == o # False if NaN, True in other cases
resamplerfilter.py(527): if cond: # original is and, the 2nd term must also be true
resamplerfilter.py(528): if not onedge: # onedge true is sufficient
resamplerfilter.py(529): if docheckover:
resamplerfilter.py(530): cond = self._checkbarover(data, fromcheck=fromcheck,
resamplerfilter.py(531): forcedata=forcedata)
resamplerfilter.py(530): cond = self._checkbarover(data, fromcheck=fromcheck,
@shanehull
shanehull / routerbackup.rsc
Created November 18, 2018 22:56
Script to backup Mikrotik config to disk, upload via FTP and ping healthchecks.io url.
# Settings
:local backupPath path/to/mikrotik.backup
:local healthchecksURL https://hc-ping.com/example
:local ftpAddress 192.168.1.10
:local ftpFullPath path/to/ftpserver/mikrotik.backup
:local ftpUser ftpuser
:local ftpPassword password
# Check if router can ping WAN
if ([/ping 8.8.8.8 count=5]=5) do={
@shanehull
shanehull / rotate-backup.sh
Last active November 26, 2018 01:57
Check if specified file exists and was created on current date. If so, copy specified file and append date to the copy, then delete files matching "$FILE*" older than retention period.
#!/bin/bash
FILE="/source/"
HEALTHCHECKSURL=""
RETENTION=10
FILEAGE=1
#### Display command usage ########
usage()
{
cat << EOF
@shanehull
shanehull / Output of octoprint serve
Created November 15, 2018 21:54
Output of ~/oprint/bin/octoprint serve --host 127.0.0.1"
2018-11-15 21:53:15,118 - octoprint.startup - INFO - ******************************************************************************
2018-11-15 21:53:15,121 - octoprint.startup - INFO - Starting OctoPrint 1.3.9
2018-11-15 21:53:15,121 - octoprint.startup - INFO - ******************************************************************************
2018-11-15 21:53:16,269 - octoprint.util.connectivity_checker - INFO - Connectivity changed from offline to online
2018-11-15 21:53:17,729 - octoprint.startup - INFO - Blacklist processing done
2018-11-15 21:53:17,781 - octoprint.plugin.core - INFO - Loading plugins from /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins, /home/pi/.octoprint/plugins and installed plugin packages...
2018-11-15 21:53:19,661 - octoprint.plugin.core - INFO - Found 12 plugin(s) providing 12 mixin implementations, 9 hook handlers
2018-11-15 21:53:19,774 - octoprint.server.heartbeat - INFO - Starting server heartbeat, 900.0s interval
2018-11-15 21:53:19,803 - octoprint.server - INFO - I
2018-11-15 00:49:54,663 - octoprint.startup - INFO - ******************************************************************************
2018-11-15 00:49:54,665 - octoprint.startup - INFO - Starting OctoPrint 1.3.9
2018-11-15 00:49:54,666 - octoprint.startup - INFO - ******************************************************************************
2018-11-15 00:49:56,101 - octoprint.startup - INFO - We don't appear to be online, not fetching plugin blacklist
2018-11-15 00:49:56,245 - octoprint.plugin.core - INFO - Loading plugins from /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins, /home/pi/.octoprint/plugins and installed plugin packages...
2018-11-15 00:49:54,610 - octoprint.startup - INFO - ******************************************************************************
2018-11-15 00:49:54,612 - octoprint.startup - INFO - Starting OctoPrint 1.3.9
2018-11-15 00:49:54,613 - octoprint.startup - INFO - ******************************************************************************
2018-11-15 00:49:55,949 -
2018-11-15 00:16:57,212 /home/pi/oprint/bin/python2 -m pip install https://github.com/foosel/OctoPrint/archive/1.3.9.zip
2018-11-15 00:17:02,262 > Collecting https://github.com/foosel/OctoPrint/archive/1.3.9.zip
2018-11-15 00:17:05,267 > Downloading https://github.com/foosel/OctoPrint/archive/1.3.9.zip
2018-11-15 00:17:31,297 > Requirement already satisfied: flask<0.11,>=0.10.1 in /home/pi/oprint/lib/python2.7/site-packages (from OctoPrint==1.3.9)
2018-11-15 00:17:31,299 > Requirement already satisfied: Jinja2<2.9,>=2.8.1 in /home/pi/oprint/lib/python2.7/site-packages (from OctoPrint==1.3.9)
2018-11-15 00:17:31,299 > Requirement already satisfied: werkzeug<0.9,>=0.8.3 in /home/pi/oprint/lib/python2.7/site-packages (from OctoPrint==1.3.9)
2018-11-15 00:17:31,300 > Collecting tornado==4.5.3 (from OctoPrint==1.3.9)
2018-11-15 00:17:37,308 > Downloading https://files.pythonhosted.org/packages/e3/7b/e29ab3d51c8df66922fea216e2bddfcb6430fb29620e5165b16a216e0d3c/tornado-4.5.3.tar.gz (484kB)
2018-11-15 00:17:45,722
2018-11-15 02:57:46,613 - octoprint.startup - INFO - ******************************************************************************
2018-11-15 02:57:46,615 - octoprint.startup - INFO - Starting OctoPrint 1.3.9
2018-11-15 02:57:46,617 - octoprint.startup - INFO - Starting in SAFE MODE. Third party plugins will be disabled!
2018-11-15 02:57:46,617 - octoprint.startup - INFO - ******************************************************************************
2018-11-15 02:57:48,031 - octoprint.startup - INFO - We don't appear to be online, not fetching plugin blacklist
2018-11-15 02:57:48,183 - octoprint.plugin.core - INFO - Loading plugins from /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins, /home/pi/.octoprint/plugins and installed plugin packages...
2018-11-15 02:57:52,687 - octoprint.plugin.core - INFO - Found 12 plugin(s) providing 11 mixin implementations, 8 hook handlers
2018-11-15 02:57:52,931 - octoprint.server.heartbeat - INFO - Starting server heartbeat, 900.0s interval
2018-11-15 02:57:53,
2018-11-15 00:50:45,288 - octoprint.startup - INFO - ******************************************************************************
2018-11-15 00:50:45,291 - octoprint.startup - INFO - Starting OctoPrint 1.3.9
2018-11-15 00:50:45,295 - octoprint.startup - INFO - ******************************************************************************
2018-11-15 00:50:46,771 - octoprint.startup - INFO - We don't appear to be online, not fetching plugin blacklist
2018-11-15 00:50:46,923 - octoprint.plugin.core - INFO - Loading plugins from /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins, /home/pi/.octoprint/plugins and installed plugin packages...
2018-11-15 00:50:49,475 - octoprint.plugin.core - INFO - Found 12 plugin(s) providing 12 mixin implementations, 9 hook handlers
2018-11-15 00:50:49,673 - octoprint.server.heartbeat - INFO - Starting server heartbeat, 900.0s interval
2018-11-15 00:50:49,839 - octoprint.server - INFO - Intermediary server started
2018-11-15 00:50:49,842 - octoprint.plugin.core - INFO