Sometimes you may want to commit only the files you have changed and not any newly created files,
this can easily be achieved by this command: git commit -a
Published directly from my personal knowledge base.
Publish new post checklist
This is my checklist for publishing a new post on my blog:
Preparation
- Finalize the posts name and sluggify it
- Pick a image if fitting
- Create a new post with
hugo new content/posts/<slug of post>.md
- Move the draft from my current writing tool to this new file
- Fill in the generated front matter template
- If the post is ~1.000+ words enable the TOC
- Run spell-check in VSCode and fix things
Proofing
- Run local hugo server
hugo server -bind=0.0.0.0
- Wait at least an hour
- Open the locally served page on the iPad, grab a cup of tea and read it
- Make last changes and typo fixes as needed
- Place a `
GitLab: User owned projects report
Export a CSV formatted report of projects in user-namespace on a GitLab instance.
This is especially useful if you think about limiting or disabling this feature.
[Read More]Simple git changelog
yamllint: Ignore exisiting errors
When adding yamllint to an existing project it can be hard to fix all the errors at once.
I wrote a simple script to create a rules block that simply ignores all rules that currently trigger for a file. This works by generating a rules block ignoring paths.
[Read More]Local User Management Polyfill
Older Versions of Windows 10 and all Windows Server 2012 systems have no local user management commandlets.
This is a working polyfill to allow scripts using local user management to run on old systems.
Local S3 with MinIO in Django
Hidden WSL Fileshare
WSL file systems get exposed as a hidden share network share:
\\wsl$\<WSL Name>\<path\to\file>
For example, my Debian home folder is at: \\wsl$\Debian\home\kamner
Windows Terminal: Open New WSL Tab In Linux Home Folder
Resolve .local Through Nameserver With Netplan
When using netplan it is easy to force .local DNS requests to go to you nameservers instead of being only resolved locally (the default and standard).
This also works with all other strange .WHATEVER domains you may have lying around in your organization.
Snippet from netplan configuration:
nameservers:
addresses:
- X
- Y
search:
- local
- myotherstupiddomain
MongoDB Logrotate
Show all active user cron jobs on a system
Debian/Ubuntu
grep -vH "#" /var/spool/cron/crontabs/*
RedHat/Centos/Rocky
grep -vH "#" /var/spool/cron/*
Customize Freshervice User Portal
DNS Resolution Everywhere
Publish Parts Of Obsidian To My Personal Site
curl: Modify DNS Resolution
How SELinux screws with scripts when run over VMware Tools
SELinux by default prohibits certain things from working through VMware tools (Ansible connection or plain API).
This can be solved two ways:
- Disabling SELinux: BAD, but easy
- Writing a custom SELinux policy: complicated but more secure
Note: Adding/Changing this policy through a VMware tools connection is thankfully possible
Example policy
This policy is the base for a VMware tools policy and allows entering the rpm context (yum).
module custom-vmtools 1.0;
require {
type rpm_script_t;
type vmtools_unconfined_t;
class process transition;
}
#============= vmtools_unconfined_t ==============
allow vmtools_unconfined_t rpm_script_t:process transition
Replace Line In YAML While Keeping Indentation Using Ansible
Looping Dates macOS
Download Full Website Copy
Sometimes it’s nice to download a best effort version of a website, for example before completely redesigning it.
domain=WEB.SITE
wget $domain --recursive --no-clobber --page-requisites --html-extension --convert-links --restrict-file-names=windows --domains $domain