Posts


Host

Install virt-manager and cockpit machines. Either can be used to manage and create virtual machines.

Fedora

sudo dnf install @virtualization cockpit cockpit-machines cockpit-pcp
sudo systemctl enable --now cockpit.socket

Ubuntu

sudo apt-get install virt-manager cockpit cockpit-machines cockpit-pcp

Add your user to the libvirt and kvm groups to avoid being asked to enter your password every time you open the management app.

sudo usermod -a -G libvirt $(whoami)
sudo usermod -a -G kvm $(whoami)

Guest

Note: the spice-vdagent is only for virtual machines with GUIs. For text only servers ssh into them directly from your host terminal.

Retrieve the IP address to remote into from the show virtual hardware details or by running ip addr show from within the virt manager terminal window.

Fedora

sudo dnf install spice-vdagent
sudo systemctl start spice-vdagent

Ubuntu

sudo apt install spice-agent
sudo systemctl start spice-vdagent

Windows

Download windows guest binaries from https://www.spice-space.org/download.html.

Reference


A couple of awesome tools I’ve just stumbled upon for windows is WinDirStat and KDirStat for linux. Windows and linux directory statistics tools. These are an invaluable tool to track what is using disk space.


If repeated docker builds cause WSL (windows subsystem for linux) to trash your system memory you can force linux to drop the page cache.

sudo su -
echo 1 > /proc/sys/vm/drop_caches

Lua can be used inside an NGINX config file to provide dynamic programming support.

Assumptions:

  • Ubuntu 20.04
  • Nginx 1.18
sudo apt install lua-nginx-cookie libnginx-mod-http-ndk libnginx-mod-http-lua -y

As a short example, this is a short Lua rewrite block accessing a cookie named ACookie and retrieving a substring.

set $substring "";
set $tempcode "";

rewrite_by_lua_block {
        ngx.var.tempcode = ngx.unescape_uri(ngx.var.cookie_ACookie)
        ngx.var.substring = string.sub(ngx.var.tempcode, 5, 10)
}

References


Requires a redis install to work with.

See my redis cluster kubernetes install post.

Connect to a cluster

redis-cli -c -h redis-redis-cluster -a $REDIS_PASSWORD

Commands

A few userful commands

Interactive

INFO
CLUSTER INFO
dbsize
ping
incr helloworld
GET hello world
set hello "world"
append hello ". Hi"
GET hello
keys "*"

cli

redis-cli --scan | head -10
redis-cli --bigkeys
redis-cli --scan --pattern '[YourSearch]:*' | wc -l

References