Has no upstream branch errors in git [1] can be such a damn productivity killer.
You gotta stop your flow and swap over the branch, there is a config so that
you don’t have to do this.
fatal has no upstream branch # [2]
If you have not yet configured git to always push to the current branch, you
will get a has no upstream branch error if you don’t explicitly set it.
Let’s show an example
git checkout -b feat/ingest-inventory-data
git add conf/base/catalog.yml
git commit -m "feat: ingest inventory data from abc-db"
git push
You will be presented with the following error.
fatal: The current branch feat/ingest-inventory-data has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin feat/ingest-inventory-data
Option 1: follow the instructions # [3]
To resolve this fatal error your first option is simply to follow the
instructions given. Just copy and paste it in.
git push --set-upstream origin feat/ingest-inventory-data
Option 2: push to the current branch without setting upstream # [4]
Honestly, I am pretty aware of the branch I am on, and Very few times have I
ever accidentally pushed to the wrong branch. The on...
Publishing rhythm
I write many of these posts from a 10 year old desktop that sits in my
office these days. It does a very fine job running all of the things I
need it to for my side work, but sometimes I want a mobile setup. I
don’t really want to spend the $$ on a new laptop just for the few times
I want to be somewhere else in the house. What I do have though is a
chromebook.
I’ve tried to get the chromebook into my workflow in the past, but have
failed. Much because by the time I got all of my tools up and running
in the linux vm it was taking up quite a bit of space on the device and
made it harder for others to use as a chromebook.
Today I am giving it a second try, but this time with ssh.
Checking for existing sshd # [1]
Before doing anything I checked to see if sshd is already running. Using
the following command.
sudo service ssh status
# or
pgrep -l sshd
Both returned nothing so I know that its not running.
setting up sshd # [2]
just apt install it
Next install the openssh-client and openssh-server
sudo apt install openssh-client -y
sudo apt install openssh-server -y
After this I can see that its now running by checking its status once
again.
sudo service ssh status
Gives me t...
patrick-kidger [1] has done a fantastic job with mkposters [2]. Highly recommend taking a look.
Make posters from Markdown files.
References:
[1]: https://github.com/patrick-kidger
[2]: https://github.com/patrick-kidger/mkposters
Mermaid gives us a way to style nodes through the use of css, but rather than
using normal css selectors we need to use style <nodeid>. This also applies
to subgraphs, and we can use the name of the subgraph in place of the nodeid.
graph TD;
a --> A
A --> B
B --> C
style A fill:#f9f,stroke:#333,stroke-width:4px
style B fill:#f9f,stroke:#333,stroke-width:4px
subgraph one
a
end
style one fill:#BADA55
produces the following graph
graph TD;
a --> A
A --> B
B --> C
style A fill:#f9f,stroke:#333,stroke-width:4px
style B fill:#f9f,stroke:#333,stroke-width:4px
subgraph one
a
end
style one fill:#BADA55
import mermaid from '/assets/vendor/mermaid/mermaid.esm.min.mjs';
const rootStyle = getComputedStyle(document.documentElement);
const css = (name, fallback) => (rootStyle.getPropertyValue(name) || fallback).trim();
const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches ||
document.documentElement.dataset.theme === 'dark';
const accent = css('--color-primary', '#ffcd11');
const flowchart = {
nodeSpacing: 60,
rankSpacing: 90,
padding: 12,
};
const themeCSS = `
.label foreignObject > div { padding: 14px 14px 10px; line-height: 1.2; }
.nodeLabel ...
I recently found a really great plugin [1] by
mhinz [2] to open files in neovim from a
different tmux split, without touching neovim at all.
Installation # [3]
neovim-remote [1] is not a neovim
plugin at all, it’s a python cli that you can install with pip. Unlike
the repo suggests, I use pipx to install nvr.
pipx install neovim-remote
How I use it # [4]
I have this added to my .envrc that is in every one of my projects.
This will tie a neovim session to that directory, and all directories
under it.
export NVIM_LISTEN_ADDRESS=/tmp/nvim-$(basename $PWD)
In my workflow I open a tmux session for each project, so this
essentially ties a neovim session to a tmux session.
Open neovim # [5]
First open neovim, but with the nvr command. This will open neovim,
and look pretty much the same as always.
nvr
If you try to run nvr again in another shell nothing will happen as
its already runnin under that address, but if you give it a filename it
will open the file in the first instance of neovim that you opened.
nvr readme.md
Links # [6]
- GitHub [1]
References:
[1]: https://github.com/mhinz/neovim-remote
[2]: https://github.com/mhinz
[3]: #installation
[4]: #how-i-use-it
[5]: #op...
Mermaid provides some really great ways to group or fence in parts of your
graphs through the use of subgraphs.
Here we can model some sort of data ingest with some raw iot device and our
warehouse in different groups.
graph TD;
subgraph raw_iot
a
end
subgraph warehouse
A --> B
B --> C
end
graph TD;
subgraph raw_iot
a
end
subgraph warehouse
A --> B
B --> C
end
connecting subgroups # [1]
If we want to connect them, we can make a connection between a and A outside of
the subgraphs.
graph TD;
subgraph raw_iot
a
end
a --> A
subgraph warehouse
A --> B
B --> C
end
graph TD;
subgraph raw_iot
a
end
a --> A
subgraph warehouse
A --> B
B --> C
end
separation of concerns # [2]
It’s also possible to specify subgraphs separate from where you define your
nodes. which allows for some different levels of grouping that would not be
possible if you were to define all your nodes inside of a subgraph.
graph TD;
a --> A
A --> B
B --> C
subgraph one
A
C
end
graph TD;
a --> A
A --> B
B --> C
subgraph warehouse
A
C
end
import mermaid from '/assets/vendor/mermaid/mermaid.esm.min.mjs';
const rootStyle = getComputedStyle(document.documentElement);
co...
I’m impressed by pype.dev [1] from pypeaday [2].
my blog?
References:
[1]: https://github.com/pypeaday/pype.dev
[2]: https://github.com/pypeaday
Just starred kedro-rich [1] by datajoely [2]. It’s an exciting project with a lot to offer.
Make your Kedro experience snazzy
References:
[1]: https://github.com/datajoely/kedro-rich
[2]: https://github.com/datajoely
If you have ever ran which <command> and see duplicate entries it’s likely
that you have duplicate entries in your $PATH. You can clean this up with a
one liner at the end of your bashrc or zshrc.
eval "typeset -U path"
Since GitHub started supporting mermaid in their markdown I wanted to
take another look at how to implement it on my site, I think it has some
very nice opportunities in teaching, documenting, and explaining things.
The docs kinda just jumped right into their mermaid language and really
went through that in a lot of depth, and skipped over how to implement
it yourself, turns out its pretty simple. You just write mermaid syntax
in a div with a class of mermaid on it!
<script src='https://unpkg.com/[email protected]/dist/mermaid.min.js'></script>
<div class='mermaid'>
graph TD;
a --> A
A --> B
B --> C
</div>
You just write mermaid syntax in a div with a class of mermaid on
it!
The above gets me this diagram.
graph TD;
a --> A
A --> B
B --> C
This feels so quick and easy to start getting some graphs up and running, but
does lead to layout shift and extra bytes down the pipe. The best solution in
my opionion would be to forgo the js and ship svg. That said, this is do dang
convenient I will be using it for some things.
import mermaid from '/assets/vendor/mermaid/mermaid.esm.min.mjs';
const rootStyle = getComputedStyle(document.documentElement);
const css = (name, fallback) => ...
There is GNU coreutils command called mktemp that is super handy in shell
scripts to make temporary landing spots for files so that they never clash with
another instance, and will automatically get cleaned up when you restart, or
whenever /tmp gets wiped. I’m not sure when that is, but I don’t expect it
to be long.
Making temp directories # [1]
Here are some examples of making temp directories in different places, my
favorite is mktemp -dt mytemp-XXXXXX.
# makes a temporary directory in /tmp/ with the defaul template tmp.XXXXXXXXXX
mktemp
# makes a temporary directory in your current directory
mktemp --directory mytemp-XXXXXX
# shorter version
mktemp -d mytemp-XXXXXX
# same thing, but makes a file
mktemp mytemp-XXXXXX
# makes a temporary directory in your /tmp/ directory (or what ever you have configured as your TMPDIR)
mktemp --directory --tmpdir mytemp-XXXXXX
# shorter version
mktemp -dt mytemp-XXXXXX
# same thing, but makes a file
mktemp --tmpdir mytemp-XXXXXX
# shorter version
mktemp -t mytemp-XXXXXX
Use Case # [2]
Here is a sample script that shows how to capture the tempdir as a variable and
reuse it. Here is an example of curling my bootstrap file into a temp
dir...
Once you give a branch the big D (git branch -D mybranch) its gone,
its lost from your history. It’s completely removed from your log.
There will be no reference to these commits, or will there?
TLDR # [1]
Checkout is your savior, all you need is the commit hash.
Immediate Regret # [2]
your terminal is still open
We have all done this, you give branch the big D only to realize it was
the wrong one. Don’t worry, not all is lost, this is the easiest to
recover from. When you run the delete command you will see something
like this.
❯ git branch -D new
Deleted branch new (was bc02a64).
Notice the hash is right there is the hash of your commit. You can use
that to get your content back.
git checkout -b bc02a64
git branch new
# or in one swoop checkout your new branch at the `start-point` you want
git checkout -b new bc02a64
Delayed reaction # [3]
you have closed your terminal
If you have closed your terminal, or have deleted with a gui or
something that does not tell you the hash as you run it, don’t fret, all
your work is still there (as long as you have commited). You just have
to dig it out. The reflog contains a list of all git [4] operations that
have occurred on your ...
It’s nearly impossible to completely loose a file if it is commited to git [1].
It’s likely harder to fully remove the file than it is to recover it, but how
do we go about recovering those precious files that we have lost.
Listing all the deleted files in all of git history can be done by
combining git log with --diff-filter. The log gives you lots of
options to show different bits of information about the commit that
happened at that point. It’s even possible to get a completely clean
list of files that are in your git history but have been deleted.
git log –diff-filter # [2]
These various commands will show all files that were ever deleted on
your current branch.
# This one includes the date, commit hash, and Author
git log --diff-filter D
# this one could be a git alias, but includes empty lines
git log --diff-filter D --pretty="format:" --name-only
# this one has the empty lines cleaned up
git log --diff-filter D --pretty="format:" --name-only | sed '/^$/d'
git diff-filter [3]
git reflog –diff-filter # [4]
The reflog can be super powerful in finding lost files here, as it only
cares about git operations, not just the current branch. It will search
accross all branch...
Git [1] commands such as diff, log, whatchanged all take a flag called
--diff-filter. This can filter for only certain types of diffs, such
as added (A), modified (M), or deleted (D).
Man page # [2]
You can find the full description by searching for --diff-filter in
the man git diff page.
--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
Select only files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (i.e. regular file, symlink, submodule, ...)
changed (T), are Unmerged (U), are Unknown (X), or have had their pairing Broken (B). Any combination of the filter characters (including none) can be used.
When * (All-or-none) is added to the combination, all paths are selected if there is any file that matches other criteria in the comparison; if there is no
file that matches other criteria, nothing is selected.
Also, these upper-case letters can be downcased to exclude. E.g. --diff-filter=ad excludes added and deleted paths.
Note that not all diffs can feature all types. For instance, diffs from the index to the working tree can never have Added entries (because the set of paths
included in the diff is limited by what is in the index). Sim...
As I am toying around with textual, I am wanting some popup user input
to take over. Textual is still pretty new and likely to change quite
significantly, so I don’t want to overdo the work I put into it, So for
now on my personal tuis I am going to shell out to tmux.
The Problem # [1]
The main issue is that when you are in a textual app, it kinda owns the
input. So if you try to run another python function that calls for
input it just cant get there. There is a
textual-inputs [2] library
that covers this, and it might work really well for some use cases, but
many of my use cases have been for things that are pre-built like
copier, and I am trying to throw something together quick.
textual is still very beta
Part of this comes down to the fact that textual is still very beta and
likely to change a lot, so all of the work I have done with it is for
quick and dirty, or fun side projects.
The Solution # [3]
So the solution that was easiest for me… shell out to a tmux popup.
The application I am working on wants to create new documents using
copier templates. copier has a fantastic cli that walks throught he
template variables and asks the user to fill them in, so I just shell...
I’m really excited about dirty-equals [1], an amazing project by samuelcolvin [2]. It’s worth exploring!
Doing dirty (but extremely useful) things with equals.
References:
[1]: https://github.com/samuelcolvin/dirty-equals
[2]: https://github.com/samuelcolvin
Big announcement recently that obs studio now builds out to a flatpak,
hopefully making it easier for all of us to install, especially us near
normies that don’t regularly compile anything from source.
install flatpak # [1]
I did not have flatpak installed so the first thing I had to do was get
the flatpak command installed, and add their default repo.
sudo apt install flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Once I had flatpak, I was able to get obs installed with the following
command.
flatpak install flathub com.obsproject.Studio
Once Installed it fired right up for me with the next command they
suggested.
flatpak run com.obsproject.Studio
It Works # [2]
Pretty straightforward, following the instructions given it all worked
for me, but it was missing a lot of the plugins that the current snap
package I am using gives me (namely virtual webcam). So I am not ready
to jump onto it until I figure out how to manage my own obs plugins.
For now I think the snap is working just well enough.
Links # [3]
- flatpak setup for ubuntu [4]
- obs release notes [5]
- obs flatpak [6]
References:
[1]: #install-flatpak
[2]: #it-wo...
Mermaid diagrams provide a way to display graphs defined as plain text.
Some markdown renderers support this as a plugin. GitHub now supports
it.
example # [1]
You can define nodes like this in mermaid, and GitHub will now render
them as a pretty graph diagram. Its rendered in svg, so its searchable
with control f and everything.
graph TD;
A-->B;
A-->C;
B-->D;
C-->D-->OUT;
E-->F-->G-->OUT
[2]
Links # [3]
- GitHub support announcement [4]
- mermaid docs [5]
import mermaid from '/assets/vendor/mermaid/mermaid.esm.min.mjs';
const rootStyle = getComputedStyle(document.documentElement);
const css = (name, fallback) => (rootStyle.getPropertyValue(name) || fallback).trim();
const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches ||
document.documentElement.dataset.theme === 'dark';
const accent = css('--color-primary', '#ffcd11');
const flowchart = {
nodeSpacing: 60,
rankSpacing: 90,
padding: 12,
};
const themeCSS = `
.label foreignObject > div { padding: 14px 14px 10px; line-height: 1.2; }
.nodeLabel { padding: 14px 14px 10px; line-height: 1.2; }
* { cursor: pointer; }
`;
const themeVariables = {
background: css('--color-background', '#...
Git [1] has a built in way to rebase all the way back to the beginning of
time. There is no need to scroll through the log to find the first
hash, or find the total number of commits. Just use --root.
git rebase --root
References:
[1]: /glossary/git/
Glances is a system monitor with a ton of features, including docker processes.
I have started using portainer to look at running docker processes, its a great
heavy-weight docker process monitor. glances works as a great lightweight
monitor to just give you the essentials, ( Name, Status, CPU%, MEM, /MAX,
IOR/s, IOW/s, Rx/s, Tx/s, Command)
install # [1]
You will need to install glances to use the glances webui. We can still use
pipx to manage our virtual environment [2] for us so that we do not need to do so
manually or run the risk of globally installed package dependency hell.
pipx install glances
pipx inject glances "glances[docker]"
You will be presented with this success message.
injected package glances into venv glances
done! ✨ 🌟 ✨
results # [3]
Now running glances will also show information about your running docker
containers.
[4]
Links # [5]
- glances docker [6]
- pipx [7]
- website [8]
- docs [9]
- github [10]
References:
[1]: #install
[2]: /virtual-environment/
[3]: #results
[4]: https://dropper.waylonwalker.com/file/f105e7f3-cd6a-4245-a45b-aba468ecc8d2.webp
[5]: #links
[6]: https://glances.readthedocs.io/en/catest/docker.html
[7]: https://pipx.pypa....