A few of my friends and I all just borked our neovim configs during a plug
update, and because none of us were using :PlugSnapshot it was painful to
recover from.
https://twitter.com/pypeaday/status/1524882893914398732
Lucky for me I did it on a home machine that I only occasionally edit from,
so I could still take the snapshot from a working machine before taking the
plunge into fixing everying.
Why snapshot # [1]
Snapshotting ensures that you install the same git [2] sha on every single plugin.
This way when you have multiple machines running your same vim config, they are
all on the same sha of each plugin, and you dont end up with weird things
happening on one machine. And then you get to decide when you are ready to
update, rather than when it breaks.
- same config everywhere
- you control the update
- in case of a borked update you have a good working place to rever to
Let’s snapshot # [3]
Running :PlugSnapshot will generate the following content in a buffer that
you can save. I chose to save mine in ~/.config/nvim/snapshot.vim.
" Generated by vim-plug
" Fri 13 May 2022 08:01:39 PM CDT
" :source this file in vim to restore the snapshot
" or execute: vim -S snapsh...
Publishing rhythm
I really like the super clean look of no status menus, no url bar, no bookmarks
bar, nothing. Don’t get me wrong these things are useful, but honestly they
take up screen real estate and I RARELY look at them. What I really want is a
toggle hotkey. I found this one from one of DT’s youtube video’s. I can now
tap xx and both the status bar at the botton and the address bar at the top
disappear.
# ~/.config/qutebrowser/config.py
config.bind("xb", "config-cycle statusbar.show always never")
config.bind("xt", "config-cycle tabs.show always never")
config.bind(
"xx",
"config-cycle statusbar.show always never;; config-cycle tabs.show always never",
)
The work on fish-lf-icons [1] by joshmedeski [2].
Fish plugin to add Nerd Font icon support to the lf terminal file manager
References:
[1]: https://github.com/joshmedeski/fish-lf-icons
[2]: https://github.com/joshmedeski
When you first start qutebrowser It will create some config files in
your home directory for you, but they will be empty.
Config # [1]
As far as I know qutebrowser will create this default config out of the
box for you, if it doesn’t, then somehow it just appeared for me 😁.
❯ tree ~/.config/qutebrowser
/home/waylon/.config/qutebrowser
├── autoconfig.yml
├── bookmarks
│ └── urls
├── config.py
├── greasemonkey
└── quickmarks
2 directories, 5 files
Why convert # [2]
You might want to confvert if you are more comfortable with the python
config, or if like me you just want config in one place and you are
stealing configuration options from others who have thiers in config.py.
Convert to py # [3]
References:
[1]: #config
[2]: #why-convert
[3]: #convert-to-py
I am often editing my own scripts as I develop them. I want to make a better
workflow for working with scripts like this.
Currently # [1]
Currently I am combining nvim with a which subshell to etit these files
like this.
for now lets use my todo command as an example
nvim `which todo`
First pass # [2]
On first pass I made a bash function to do exactly what I have been doing.
ewhich () {$EDITOR `which "$1"`}
The $1 will pass the first input to the which subshell. Now we can edit our todo script like this.
ewich todo
Note, I use bash functions instead of aliases for things that require input.
Final State # [3]
This works fine for commands that are files, but not aliases or shell
functions. Next I jumped to looking at the output of command -V $1.
- if the command is not found, search for a file
- if its a builtin, exit
- if its an alias, open my ~/.alias file to that line
- if its a function, open my ~/.alias file to that line
ewhich () {
case `command -V $1` in
"$1 not found")
FILE=`fzf --prompt "$1 not found searching ..." --query $1`
[ -z "$FILE" ] && echo "closing" || $EDITOR $FILE;;
*"is a shell builtin"*)
echo "$1 is a builtin";;
*"is an alias"*)
$EDITOR...
I am getting ready to do some timeseries analysis on a git [1] repo with python, my
first step is to figure out a way to list all of the git commits so that I can
analyze each one however I want. The GitPython library made this almost
trivial once I realized how.
from git import Repo
repo = Repo('.')
commits = repo.iter_commits()
This returns a generator, if you are iterating over them this is likely what
you want.
commits
# <generator object Commit._iter_from_process_or_stream at 0x7f3307584510>
The generator will return git.Commit objects with lots of information about
each commit such as hexsha, author, commited_datetime, gpgsig, and
message.
next(commits)
# <git.Commit "d125317892d0fab10a36638a2d23356ba25c5621">
References:
[1]: /glossary/git/
I was editing some blog posts over ssh, when I ran into
this error. gpg was failing to sign my commits. I
realized that this was because I could not answer to the
desktop keyring over ssh, but had no idea how to fix it.
Error # [1]
This is the error message I was seeing.
gpg failed to sign the data ssh
The fix # [2]
The fix ended up being pretty simple, but quite a ways down this stack overflow post [3].
This environment variable tells gpg that we are not logged
into a desktop and it does not try to use the desktop
keyring, and asks to unlog the gpgkey right in the
terminal.
export GPG_TTY=$(tty)
The log in menu # [4]
This is what it looks like when it asks for the passphrase.
[5]
EDIT-another way # [6]
So this did not fix the issue on Arch BTW, and I have seen it not work for wsl
users either. This did work for me and reported to have worked by a wsl user
on a github issue.
echo '' | gpg --clearsign
This will unlock the gpg key then let you commit.
References:
[1]: #error
[2]: #the-fix
[3]: https://stackoverflow.com/questions/41052538/git-error-gpg-failed-to-sign-data/41054093
[4]: #the-log-in-menu
[5]: https://dropper.waylonwalker.com/file/9089a37a-fdbb-4f00-9f4a-...
If you’re into interesting projects, don’t miss out on wish-lists [1], created by pypeaday [2].
amazon wish lists replacement
References:
[1]: https://github.com/pypeaday/wish-lists
[2]: https://github.com/pypeaday
I’m really excited about typeshed [1], an amazing project by python [2]. It’s worth exploring!
Collection of library stubs for Python, with static types
References:
[1]: https://github.com/python/typeshed
[2]: https://github.com/python
If you’re into interesting projects, don’t miss out on mypy [1], created by python [2].
Optional static typing for Python
References:
[1]: https://github.com/python/mypy
[2]: https://github.com/python
Sometimes you get a PR on a project, but cannot review it without wrecking your
current working setup. This might be because it needs to be compiled, or a new
set of requirements. Git [1] worktrees is a great way to chekout the remote branch
in a completely separate directory to avoid changing any files in your current
project.
# pattern
# git worktree add -b <branch-name> <PATH> <remote>/<branch-name>
git worktree add -b fix-aws-service-cnsn /tmp/project origin/fix-aws-service-cnsn
This will create a new directory /tmp/project that you can review the branch
fix-aws-service-cnsn from the remote origin. If you have setup different remotes locally you can check for the name of it with git remote -v
References:
[1]: /glossary/git/
I’m impressed by devshell [1] from numtide [2].
Per project developer environments
References:
[1]: https://github.com/numtide/devshell
[2]: https://github.com/numtide
The work on pyscript [1] by pyscript [2].
PyScript is an open source platform for Python in the browser. Try PyScript: https://pyscript.com Examples: https://tinyurl.com/pyscript-examples Community: https://discord.gg/HxvBtukrg2
References:
[1]: https://github.com/pyscript/pyscript
[2]: https://github.com/pyscript
Check out pypeaday [1] and their project tdarr [2].
tdarr setup
References:
[1]: https://github.com/pypeaday
[2]: https://github.com/pypeaday/tdarr
If you’re into interesting projects, don’t miss out on skedulord [1], created by koaning [2].
captures logs and makes cron more fun
References:
[1]: https://github.com/koaning/skedulord
[2]: https://github.com/koaning
GitPython is a python api for your git [1] repos, it can be quite handy when you
need to work with git from python.
Use Case # [2]
I recently made myself a handy tool for making screenshots in python and it
need to do a git commit and push from within the script. For this I reached
for GitPython.
How I Quickly Capture Screenshots directly into My Blog [3]
Installation # [4]
GitPython is a python library hosted on pypi that we will want to install
into our virtual environments using pip.
pip install GitPython
Create a Repo Object # [5]
Import Repo from the git library and create an instance of the Repo object by
giving it a path to the directory containing your .git directory.
from git import Repo
repo = Repo('~/git/waylonwalker.com/')
Two interfaces # [6]
from the docs
It provides abstractions of git objects for easy access of repository data,
and additionally allows you to access the git repository more directly using
either a pure python implementation, or the faster, but more resource
intensive git command implementation.
I only needed to use the more intensive but familar to me git command
implementation to get me project off the ground. There is a good
tutorial [...
nvim-notify [1] by rcarriga [2] is a game-changer in its space. Excited to see how it evolves.
A fancy, configurable, notification manager for NeoVim
References:
[1]: https://github.com/rcarriga/nvim-notify
[2]: https://github.com/rcarriga
I came across smart-sec-cam [1] from scottbarnesg [2], and it’s packed with great features and ideas.
A privacy-focused, intelligent security camera system.
References:
[1]: https://github.com/scottbarnesg/smart-sec-cam
[2]: https://github.com/scottbarnesg
Python, click install
Edit the System Environment Variables
Environment Variables button
Add the following path to your users Path Variable
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\dotnet\;C:\Users\quadm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts;
I came across cli [1] from httpie [2], and it’s packed with great features and ideas.
🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
References:
[1]: https://github.com/httpie/cli
[2]: https://github.com/httpie