Compare commits

...

7 Commits

Author SHA1 Message Date
John Bowdre 57ff741c14 disable remember_owner in qemu.conf 2023-02-20 17:22:05 -06:00
John Bowdre 4728a9912e Merge branch 'main' of github.com:jbowdre/virtuallypotato 2023-02-20 14:37:59 -06:00
John Bowdre 257473991d new post: cat-file-without-comments 2023-02-20 14:37:50 -06:00
John Bowdre 257334e7c8
Update daily_build.yml 2023-02-20 14:36:47 -06:00
John Bowdre ebc32e89b7
Update daily_build.yml 2023-02-20 14:28:46 -06:00
John Bowdre 785c5b6834
Update daily_build.yml 2023-02-20 14:23:29 -06:00
John Bowdre 4eb422531f
Create daily_build.yml 2023-02-20 14:21:01 -06:00
3 changed files with 74 additions and 0 deletions

14
.github/workflows/daily_build.yml vendored Normal file
View File

@ -0,0 +1,14 @@
name: Daily build
on:
schedule:
- cron: "0 13 * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Trigger build webhook on Netlify
run: curl -s -X POST "https://api.netlify.com/build_hooks/${TOKEN}"
env:
TOKEN: ${{ secrets.NETLIFY_CRON_BUILD_HOOK }}

View File

@ -0,0 +1,54 @@
---
title: "Cat a File Without Comments" # Title of the blog post.
date: 2023-02-22 # Date of post creation.
# lastmod: 2023-02-20T10:32:20-06:00 # Date when last modified
description: "A quick trick to strip out the comments when viewing the contents of a file." # Description used for search engine.
featured: false # Sets if post is a featured post, making appear on the home page side bar.
draft: false # Sets whether to render this page. Draft of true will not be rendered.
toc: true # Controls if a table of contents should be generated for first-level links automatically.
usePageBundles: true
# menu: main
# featureImage: "file.png" # Sets featured image on blog post.
# featureImageAlt: 'Description of image' # Alternative text for featured image.
# featureImageCap: 'This is the featured image.' # Caption (optional).
# thumbnail: "thumbnail.png" # Sets thumbnail image appearing inside card on homepage.
# shareImage: "share.png" # Designate a separate image for social media sharing.
codeLineNumbers: false # Override global value for showing of line numbers within code block.
series: Tips # Projects, Scripts, vRA8, K8s on vSphere
tags:
- linux
- shell
- regex
comment: true # Disable comment if false.
---
It's super handy when a Linux config file is loaded with comments to tell you precisely how to configure the thing, but all those comments can really get in the way when you're trying to review the current configuration.
Next time, instead of scrolling through page after page of lengthy embedded explanations, just use:
```shell
egrep -v "^\s*(#|$)" $filename
```
For added usefulness, I alias this command to `ccat` (which my brain interprets as "commentless cat") in [my `~/.zshrc`](https://github.com/jbowdre/dotfiles/blob/main/zsh/.zshrc):
```shell
alias ccat='egrep -v "^\s*(#|$)"'
```
Now instead of viewing all 75 lines of a [mostly-default Vagrantfile](/create-vms-chromebook-hashicorp-vagrant), I just see the 7 that matter:
```shell
; wc -l Vagrantfile
75 Vagrantfile
; ccat Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "oopsme/windows11-22h2"
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 4
libvirt.memory = 4
end
end
; ccat Vagrantfile | wc -l
7
```
Nice!

View File

@ -52,6 +52,12 @@ And to avoid having to `sudo` each time I interact with `libvirt` I'll add mysel
sudo gpasswd -a $USER libvirt ; newgrp libvirt
```
And to avoid [this issue](https://github.com/virt-manager/virt-manager/issues/333) I'll make a tweak to the `qemu.conf` file:
```shell
echo "remember_owner = 0" | sudo tee -a /etc/libvirt/qemu.conf
sudo systemctl restart libvirtd
```
I'm also going to use `rsync` to share a [synced folder](https://developer.hashicorp.com/vagrant/docs/synced-folders/basic_usage) between the host and the VM guest so I'll need to make sure that's installed too:
```shell
sudo apt install rsync