jq has some syntax that will sneak up on you with complexity. It looks so good,
and so understandable, but everytime I go to use it myself, I don’t get it.
ijq is an interactive alternative to jq that gives you and nice repl that you
can iterate on queries quickly.
paru -Syu ijq
Here are some other articles, I decided to link at the time of writing this article.
JUT | Read Notebooks in the Terminal [1]
Comprehensive guide to creating kedro nodes [2]
Kedro - My Data Is Not A Table [3]
References:
[1]: /jut/
[2]: /kedro-node/
[3]: /kedro-pickle/
Publishing rhythm
I like deresmos’s [1] project xrandr-manager [2].
Manage dual display on Linux
References:
[1]: https://github.com/deresmos
[2]: https://github.com/deresmos/xrandr-manager
If you’re into interesting projects, don’t miss out on xpadneo [1], created by atar-axis [2].
Advanced Linux Driver for Xbox One Wireless Controller (shipped with Xbox One S)
References:
[1]: https://github.com/atar-axis/xpadneo
[2]: https://github.com/atar-axis
I came across Launcher-Curseforge [1] from ShayBox [2], and it’s packed with great features and ideas.
Integrates the CF Modpack install button to any MMC based launcher
References:
[1]: https://github.com/ShayBox/Launcher-Curseforge
[2]: https://github.com/ShayBox
[1]
Recently I added two new bash/zsh aliases to make my git [2] experience just a tad
better.
trackme # [3]
Most of our work repos were recently migrated to new remote urls, we scriped
out the update to all of the repos, but I was left with a tracking error for
all of my open branches. To easily resolve this I just made an alias so that I
can just run trackme anytime I see this error.
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream develop origin/<branch>
getting the branch # [4]
The following command will always return the currently checked out branch name.
git symbolic-ref --short HEAD
Injecting this into the suggested git command as a subshell gives us this
alias that when ran with trackme will automatically fix tracking for my
branch.
alias trackme='git branch --set-upstream-to=origin/$(git symbolic-ref --short HEAD)'
rebasemain # [5]
I sometimes get a bit lazy at checking main for changes before submitting any
prs, so again I made a quick shell...
Check out pip-tools [1] by jazzband [2]. It’s a well-crafted project with great potential.
A set of tools to keep your pinned Python dependencies fresh.
References:
[1]: https://github.com/jazzband/pip-tools
[2]: https://github.com/jazzband
So many terminal applications bind q to exit, even the python debugger, its
muscle memory for me. But to exit ipython I have to type out exit<ENTER>.
This is fine, but since q is muscle memory for me I get this error a few times
per day.
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ <ipython-input-1-2b66fd261ee5>:1 in <module> │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
NameError: name 'q' is not defined
After digging way too deep into how IPython implements its ExitAutoCall I
realized there was a very simple solution here. IPython automatically
imports all the scripts you put in your profile directory, all I needed was to
create ~/.ipython/profile_default/startup/q.py with the following.
q = exit
It was that simple. This is not a game changer by any means, but I will now
see one less error in my workflow. I just press q<Enter> and I am out,
without error.
It’s no secret that I love automation, and lately my templating framework of
choice has been copier. One hiccup I recently ran into was having spaces in my
templated directory names. This makes it harder to run commands against as you
need to escape them, and if they end up in a url you end up with ugly %20 all
over.
Cookiecutter has the solution # [1]
Yes the solution comes from a competing templating framework.
I install copier with pipx, so I need to inject cookiecutter in to my copier
environment to use the slugify filter.
pipx inject copier cookiecutter
If you are using a normal virtual environment [2] you can just pip install it.
pip install copier cookiecutter
add the extension to your template # [3]
copier.yml
Now to enable the extension you need to declare it in your copier.yml file in
your template.
_jinja_extensions:
- cookiecutter.extensions.SlugifyExtension
Use it | slugify # [4]
use-it
Now to use it, anywhere that you want to slugify a variable, you just pipe it
into slugify.
❯ tree .
.
├── copier.yml
├── README.md
└── {{ site_name|slugify }}
└── markata.toml.jinja
1 directory, 3 files
Here is a slimmed down version of what the copier.yml looks like.
...
I came across box-cli-maker [1] from box-cli-maker [2], and it’s packed with great features and ideas.
Render highly customizable boxes in the terminal
References:
[1]: https://github.com/box-cli-maker/box-cli-maker
[2]: https://github.com/box-cli-maker
box-cli-maker [1] by Delta456 [2] is a game-changer in its space. Excited to see how it evolves.
Make Highly Customized Boxes for CLI
References:
[1]: https://github.com/Delta456/box-cli-maker
[2]: https://github.com/Delta456
I love getting faster in my workflow, something I have recently added in is
creating GitHub repos with the cli. I often create little examples of
projects, but they just end up on my machine and not anywhere that someone else
can see, mostly because it takes more effort to go create a repo. TIL you can
create a repo right from the command line and push to it immediately.
gh repo create waylonwalker-cli
[1]
want to see what this repo I created is about? # [2]
Check out what I created here.
pipx run waylonwalker
References:
[1]: https://dropper.waylonwalker.com/api/file/3a889b2a-d83f-4f42-a849-1c34b8e6365c.webp
[2]: #want-to-see-what-this-repo-i-created-is-about
Textual has devtools in the upcoming css branch, and its pretty awesome!
It’s still early # [1]
Textual is still very early and not really ready for prime time, but it’s quite
amazing how easy some things such as creating keybindings is. The docs are
coming, but missing right now so if you want to use textual be ready for
reading source code and examples.
On to the devtools # [2]
As [3]@willmcgugan [4] shows in this tweet it’s
pretty easy to setup, it requires having two terminals open, or using tmux, and
currently you have to use the css branch.
https://twitter.com/willmcgugan/status/1531294412696956930
Why does textual need its own devtools # [5]
Textual is a tui application framework. Unlike when you are building cli
applications, when the tui takes over the terminal in full screen there is no
where to print statement debug, and breakpoints don’t work.
getting the css branch # [6]
In the future it will likely be in main and not need this, but for now you need
to get the css branch to get devtools.
git clone https://github.com/Textualize/textual
git fetch --alll
git checkout css
install in a virtual environment [7] # [8]
Now you can create a virtual environment, fee...
I’m really excited about minesweeper [1], an amazing project by NotUnlikeTheWaves [2]. It’s worth exploring!
A minesweeper in the terminal written in Golang with Bubbletea
References:
[1]: https://github.com/NotUnlikeTheWaves/minesweeper
[2]: https://github.com/NotUnlikeTheWaves
The work on gh-eco [1] by jrnxf [2].
🦎 gh cli extension to explore the ecosystem
References:
[1]: https://github.com/jrnxf/gh-eco
[2]: https://github.com/jrnxf
totally guessed at this post’s date
I’m still trying to understand this one, but this is how you force a
python object to stop atexit.
import atexit
class Server:
def __init__(
self,
auto_restart: bool = True,
directory: Union[str, "Path"] = None,
port: int = 8000,
):
if directory is None:
from markata import Markata
m = Markata()
directory = m.config["output_dir"]
self.directory = directory
self.port = find_port(port=port)
self.start_server()
atexit.register(self.kill)
def start_server(self):
import subprocess
self.cmd = [
"python",
"-m",
"http.server",
str(self.port),
"--directory",
self.directory,
]
self.proc = subprocess.Popen(
self.cmd,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
)
self.start_time = time.time()
def kill(self):
self.auto_restart = False
self.proc.kill()
def __rich__(self) -> Panel:
if not self.proc.poll():
return Panel(
f"[green]serving on port: [gold1]{self.port} [green]using pid: [gold1]{self.proc.pid} [green]uptime: [gold1]{self.uptime} [green]link: [gold1] http://localhost:{self.port}[/]",
border_style="blue",
title="server",
)
else:
if self.auto_restart:
self.start_server()
return Panel(f"[red]...
Whenever you are installing python packages, you should always use a virtual
environment. pip makes this easy to follow by adding some configuration to
pip.
require-virtualenv # [1]
Pip is the pacakage tool for python. It installs third-party packages and is
configurable. One of the configuration settings that I highly reccommend
everyone to add is require-virtualenv. This will stop pip from installing
any packages if you have not activated a virtualenv.
why # [2]
python packages often require many different dependencies, sometimes packages
are up to date and sometimes they require different versions of dependencies.
If you install everything in one environment its easy to end up with version
conflict issues that are really hard to resolve, especially since your system
environment cannot easily be restarted.
PIPX my one exception # [3]
My one exception that I put in my system level packages is pipx. pipx is
very handy as it manages virtual environments for you and is intended for
command line utilities that would end up in your system env or require you to
manually manage virtual environments without it.
pip config # [4]
Your pip config might be found in either ~/.pip/pi...
I’ve been trying to adopt pyenv for a few months, but have been completely
blocked by this issue on one of the main machines I use. Whenever I start up
ipython I get the following error.
ImportError: No module named '_sqlite3
I talked about why and how to use pyenv along with my first impressions in
this post [1]
pyenv/issues/678 # [2]
According to #678 [3] I need to
install libsqlite3-dev on ubuntu to resolve this issue.
install libsqlite3-dev # [4]
libsqlite3-dev can be installed using apt
sudo apt install libsqlite3-dev
But wait…. # [5]
When I make a fresh env and install ipython I still get the same error and I am
still not able to use ipython with pyenv.
ImportError: No module named '_sqlite3
re-install python # [6]
After having this issue for awhile an coming back to
#678 [3] several times I realized that
libsqlite3-dev needs to be installed while during install.
pyenv install 3.8.13
I think I had tried this several times, but was missing the -y option each
time. You gotta read errors like this, I am really good at glossing over them.
[7]
Let’s never have this issue again. # [8]
When you spend months living with little errors like this and finally fix it,
it...
Sometimes you have a pretty old branch you are trying to merge into and you are
absolutely sure what you have is what you want, and therefore you don’t want to
deal with any sort of merge conflicts, you would rather just tell git [1] to use my
version and move on.
update main # [2]
The first step is to make sure your local copy of the branch you are moving
into is up to date.
git checkout main
git pull
update your feature branch # [3]
It’s also worth updating your feature branch before doing the merge. Maybe you
have teammates that have updated the repo, or you popped in a quick change from
the web ui. It’s simple and worth checking.
git checkout my-feature
git pull
start the merge # [4]
Merge the changes from main into my-feature branch.
git merge main
Now is where the merge conflict may have started. If you are completely sure
that your copy is correct you can --ours, if you are completely sure that
main is correct, you can --theirs.
git checkout --ours .
git merge --continue
This will pop open your configured git.core.editor or $EDTIOR. If you have
not configured your editor, it will default to vim. Close vim with <escape>:x, accepting the
merge message.
Now push y...
Check out Cveinnt [1] and their project LiveTerm [2].
💻 Build terminal styled websites in minutes!
References:
[1]: https://github.com/Cveinnt
[2]: https://github.com/Cveinnt/LiveTerm
curl [1] has done a fantastic job with curl [2]. Highly recommend taking a look.
A command line tool and library for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS and WSS. libcurl offers a myriad of powerful features
References:
[1]: https://github.com/curl
[2]: https://github.com/curl/curl