Same procedure as last time? Same procedure, just for stuff which won’t require an own post (yet).
» ADB (Android Debug Bridge)
USB Devices are connected automatically.
Connect device via network:
| |
List connected devices:
| |
Sideload:
| |
» curl
Save with remote filename (short -O):
| |
Save with given filename (short -o):
| |
http://www.compciv.org/recipes/cli/downloading-with-curl/
To follow redirects add --location (short -L).
Silent add --silent (short -s).
» dd
» Copy an ISO to an USB-stick
| |
https://www.cyberciti.biz/faq/creating-a-bootable-ubuntu-usb-stick-on-a-debian-linux/
» Takeover Installation
Overwrite your existing system.
Sseems to be a bit buggy, maybe important parts of the image itself get overwritten.
Preferably, store your image in a tmpfs mount (e.g. /run/shm).
| |
» envsubst
Replace environment variables (e.g. ${MY_VAR}) in a file:
| |
If the input and output file should be the same:
| |
or without sponge but more verbose:
| |
envsubst is part of the gettext package and sponge of the moreutils package in Alpine Linux.
Reference: derobert and Derek Mahar
» find
List all files with a specific name, e.g. .DS_Store:
| |
Add -delete to delete all of them.
» git
» Delete remote tag
| |
» Delete merged branches
| |
Reference: https://digitaldrummerj.me/git-remove-local-merged-branches/
»
Globally set default branch to main
| |
» Rebase current branch to drop a given commit
Attention to the ~:
| |
Then “normally” drop the commits you want to remove.
Reference: David Deutsch and KiriSakow
As an alternative and you know that the commit you want to remove is within the last N (e.g. 10) commits, use:
| |
» Compare local branch with remote branch
Gets the current branch name from a subshell, so you can reuse the command from your shell history.
| |
» Reset local branch to remote branch
Similarly to the comparison, we can reset our local branch to the remote branch:
| |
» Always rebase against default branch
Some repos use main, some still master as their default branch.
When you use rebase from history with the default branch hardcoded, it will fail when it’s a different default branch.
Use the subshell to figure out the default branch, so you can always use this command from your shell history.
| |
» Github Workflows
» Access a private repository
When you need access to another private repository inside a Github Workflow (e.g. private Go package repo), add this to your Job’s steps:
| |
Where ACESS_TOKEN is a token which has access to the private repo.
References:
» grep
List all files with occurences of SearchPattern in /path/to/folder and subfolders:
| |
If you want to use a regexp, remove --fixed-strings.
Reference: How to use “grep” command to find text including subdirectories
» helm
» Cascade check possible null values
When you want to check a value (here addr) where other sections might be null (e.g. networking or ipv4) use round brackets so the if condition will be false instead of just crashing.
| |
» Resource Checksum Annotation
Add the checksum of another resource (e.g. configmap or secret) to the deployment annoatations. This way, the deployment will be restarted when the checksum (configmap/secret) changes. Otherwise, it could be easily forgotten to restart the deployment and you are wondering why it doesn’t behave as you would expect.
| |
» Homebrew
» Cleanup and upgrade everything
| |
» Bundle
Dump:
| |
Install:
| |
Cleanup:
| |
» Remove all installed tools
| |
https://apple.stackexchange.com/a/339096/487634
» KeePassXC
Export password as environment variable:
| |
» Minio Client
» Add Oracle Object Storage
- Create a “Customer Secret Key” in your user settings.
- The Region Name is shown in the Web-UI. Find the corresponding Region Identifier: https://docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm
- Find your Object Storage Namespace (in the Web-UI shown on the Tenancy Details page): https://docs.oracle.com/en-us/iaas/Content/Object/Tasks/understandingnamespaces.htm
Adjust <NAMESPACE> and <REGION> and add the following entry to your Minio Client Config (e.g. ~/.mc/config.json):
| |
https://docs.oracle.com/en-us/iaas/Content/Object/Concepts/dedicatedendpoints.htm
» NixOS
Use sudo as channels are set per user!
Show the current release channel:
| |
Switch to another channel, e.g. 23.05:
| |
Update the system (equivalent to apt update && apt upgrade on Debian):
| |
Delete old generations:
| |
https://nixos.org/manual/nixos/stable/#sec-upgrading
» Prometheus
»
0 instead of no data
Add OR on() vector(0) to your query.
Credits: Nicolai Antiferov
» Metrics with hight label cardinality
count by (__name__, job, instance) ({__name__=~".*"}) > 1000
» tar
extract:
| |
Add --verbose when you want to see which files got extracted.
Not so difficult when you use the long flag names. The flags all together in short: -xzvf.
https://www.cyberciti.biz/faq/linux-unix-bsd-extract-targz-file/
» talosctl
» Reboot
| |
» Upgrade Talos
Upgrade to e.g. v1.3.0. Use --preserve when you are running a single node cluster.
| |
» Upgrade Kubernetes
When you upgrade the Talos version, it will not automatically upgrade the Kubernetes version. You have to do this in a separate step. For example, to upgrade Kubernetes to version 1.26.0:
| |
» timeout
Kill a command after a specified duration:
| |
Stop with SIGINT:
| |
Add --preserve-status to use the status of the invoked tool even when timeout kills it.
» ts
Add a timestamp to every output line:
| |
ts is part of the moreutils package.