Shell snippets¶
(The snippets on this page are MIT-0. Use them how you want!)
Clean a directory and rebuild a specfile¶
srpm() {
find -mindepth 1 -maxdepth 1 -name '*.src.rpm' -delete -print
spectool -g "$1"
rpmbuild -bs "$@"
}
Download a video with full metadata¶
Get the full path of a file¶
Git aliases¶
Merge back rawhide to stable Fedoras¶
The || break
makes sure the loop stops if one branch fails.
for b in f39 f38 f37; do; (git switch $b && grbS rawhide && gp && fedpkg build --nowait) || break; done
Create updates for stable Fedoras¶
for b in f39 f38 f37; do; fedpkg --release $b update --type=enhancement --notes "$(git show -q --format=%s HEAD)" || break; done
Set ZSH history to a high number¶
You’ll thank me later when you need to find a command.
Guess the id of the next Github PR in a repo¶
This is useful for repositories that use tools like towncrier or antsibull-changelog or similar tools that require identifying the PR in a changelog entry.
nextpr() {
echo "$(( "$((for i in pr issue; gh $i list --state all | head -n1 | awk '{print $1}') | sort -h | tail -n1)" + 1 ))"
}
Prevent pip install related damage¶
This prevents you from accidentally using pip to modify your global environment.