Posts


Mac specific

If you do not have brew install it before proceeding. See https://brew.sh.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install node

Install visual studio for mac 2022

At the time of this writing it is in preview

https://visualstudio.microsoft.com/vs/mac/preview/

Install docker desktop for mac

See https://docs.docker.com/desktop/mac for more info.

Ubuntu linux specific

docker install

sudo apt install -y docker.io docker-compose

# docker permissions
#sudo groupadd docker
sudo usermod -aG docker $USER
sudo chown root:docker /var/run/docker.sock
sudo chown -R root:docker /var/run/docker
# this works but the group does not?  Why?
sudo chown $USER /var/run/docker.sock
newgrp docker

Nodejs install

See https://github.com/nodesource/distributions/blob/master/README.md#deb

curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -
sudo apt-get install -y nodejs

Rider and dotnet

On linux use rider as the IDE.

# see https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#2004-
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

sudo apt-get update; \
  sudo apt-get install -y apt-transport-https && \
  sudo apt-get update && \
  sudo apt-get install -y dotnet-runtime-6.0 aspnetcore-runtime-6.0 dotnet-sdk-6.0

snap install rider --classic

Nuget

List nuget sources

dotnet nuget list source

Start fresh with just nuget.org

dotnet new nugetconfig

Add private nuget source

Add any private nuget sources that you need. This is optional.

dotnet nuget add source "https://[YourPrivateRegistry]/v3/index.json" -n [Feed Name] -u YourUserName -p YourPassword --store-password-in-clear-text

Restore

dotnet restore [Your Solution Name].sln


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