All posts by Steven

.NET Core setup in Void

Here are the steps I did to get .NET core 8 setup on my Void Linux box.

$ wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
$ sudo ./dotnet-install.sh --channel 8.0$ 
$ sudo xbps-install vscode
$ sudo xbps-install nerd-fonts
$ sudo xbps-install font-emoji-one-color

$ dotnet new blazor -o BlazorApp
$ cd BlazorApp
$ dotnet watch

Now dotnet runs and the emojis render as expected:

Then  setup the prompt to be like Hanselmans post:

$ sudo xbps-install go
$ go install github.com/justjanne/powerline-go@latest

Then we install the Cascadia Font:

$ unzip CascadiaCode*.zip 
$ cd CasCadiaCode 
$ sudo mv *.ttf /usr/share/fonts/TTF/

Then modify the font settings in your terminal to use Cascadia and your prompt will look something like this :

Lessons in Rust: Part 1

I watched some videos today and here are some notes I took:

  • A function not ending in a semicolon being a expression versus a statement is odd.
  • A function having a return statement can end in semicolon and be an expression.
  • Stack is LIFO. Stack can only hold data of a fixed size. A double quoted string is fixed length. A String::from is dynamic length and stored on the Heap.
  • When a value is put in the Heap, the Heap is searched for space large enough to hold the element (out of order, versus the Stack always in LIFO order).
  • All Heap values have a ‘pointer’ value in the Stack.
  • When a variable is passed into a function the function takes ‘ownership’ of the variable. Three ways to ‘fix’ this issue:
    • Clone traight, potentially performance impacting.
    • Copy traight (which requires Clone traight). Copy is explicit and Clone is implicit (in the way its called .clone() versus not).
    • Use a READ_ONLY_REFERENCE of a variable using the “&” on the parameter name.
  • With variables to functions, the MUTABLE_REFERENCE can only be applied once, versus the READ_ONLY_REFERENCE which can have many.
  • Lifetimes
    • Begin with a single quote.
    • Are only relevant for references.
    • They dont change the lifetimes of the parameters.
    • They can be inferred

I found these videos interesting:

Getting Rusty

With the continued impressive industry reception and excitement around Rust,  I think it is time I jump and and see what all the hub·bub is about.

After watching a few starter videos, and reading documentation, here are some of my  initial thoughts:

  • Statically compilied versus interpreted (like my dear Python language.)
  • Performance is almost hard to believe compared to some other languages doing like processes.
  • Memory-safety and thread-safety design ground up sounds like a dream come true for those of us who have fought those demons.
  • Creates is to Rust what Pip is to Python.
  • A lot of people seem to have issues (or at least a hard time understanding) what Rust’s Borrowing is all about.
  • None over Null data type is interesting for a hard core C# developer.
  • The Crab logo is odd, as is the entire “cRUSTaceans” name used by those who adore Rust.
  • Linux kernel is going to have Rust support with v6.1. I never thought I would ever see anything but C in Linux kernel code.
  • Redox is an entire operation system written in Rust

I think the first thing I am going to try to tackle with Rust is media file processing for Roadie. Perhaps re-write Inspector in Rust.

Wish me luck getting Rusty!

Postgres on podman

Steps to getting PostgreSQL running on Endeavor via Podman.

Install Podman:

sudo pacman -S podman podman-docker

Create the PostgreSQL container:


sudo podman run -d --rm -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=dapassword -e PGDATA=/opt/pgdata --volume /opt/postgres:/opt/pgdata postgres

Copy the backup to the container:

sudo podman cp /home/steven/Downloads/kapowey.tar kapoweypg:/tmp/

Run bash on the container and create the database as the postgres user

sudo podman exec -it 396 /bin/bash
su - postgres
createdb kapowey

Restore the backup on the container:

sudo podman exec -i 396 pg_restore -U postgres -c -v -d kapowey "/tmp/kapowey.tar"

Setup user on database:

CREATE user kapowey with encrypted password 'dapassword';

ALTER database kapowey OWNER to kapowey;

GRANT CONNECT ON DATABASE kapowey TO kapowey;

GRANT all privileges on database kapowey to kapowey;

GRANT all privileges on all tables in schema public to kapowey;

running jellyfin via podman

Here are the quick and dirty step I do to update images, containers and run Jellyfin via Podman:

  • sudo podman ps # get container id
  • sudo podman stop #
  • sudo podman rm #
  • sudo podman images # get the image id
  • sudo podman rmi -f #
  • sudo podman run -d --cgroup-manager=systemd --volume /opt/jellyfin/config:/config --volume /opt/jellyfin/cache:/cache --volume /storage/videos/:/media --volume /storage/books:/books --volume /opt/zap2xml:/zap2xml --net=host --restart=unless-stopped --device /dev/dri/renderD128:/dev/dri/renderD128 --device /dev/dri/card0:/dev/dri/card0 jellyfin/jellyfin:unstable
  • sudo podman run -d --name zap2xml -v /opt/zap2xml:/data -e USERNAME=youremail@email.com -e PASSWORD=**password** -e OPT_ARGS="-I -D" -e XMLTV_FILENAME=xmltv.xml shuaiscott/zap2xml

 

GoAccess working with Centos 7

I use Nginx as a proxy for my dotnet core application and with that I wanted to get some reporting so I installed GoAccess, which generates a nice HTML report.

Set this up in your root crontab via a “crontab -e” as root:

0 * * * * /bin/bash /opt/generate_report.sh

~

Note the extra blank line, you will go crazy trying to get this to work if you don’t add the blank line at the end.

Then edit your generate_report.sh file like this:

#!/bin/sh
/usr/bin/zcat -f /var/log/nginx/*.log* | /usr/bin/goaccess --log-format=COMBINED -o /var/www/logreport.html -

Note the extra “-” at the end of the command line without it the cron execute does not work.

Enjoy!

CentOS First Steps

First security steps when setting up any new internet facing linux server:

  • Create a new user account
    • # adduser username
    • # passwd username
    • # usermod -aG wheel username
  • Send SSH key
    • scp id_rsa.pub username@hostname:/home/username/id_rsa.pub
    • $ mkdir ~/.ssh
    • $ cat id_rsa.pub >> ~/.ssh/authorized_keys
    • $ chmod 700 ~/.ssh
    • $ chmod 600 ~/.ssh/authorized_keys
  • Ensure SSH key authentication works
    • Disconnect and then reconnect, you should get prompted for your private key password not your server password (you did provide a password for your private key, right?!)
    • Do not disable “PasswordAuthentication” option below unless you are positive you are authentication SSH via keys – you will be locked out of your server and no longer able to SSH in.
  • Disable Root SSH, Set Protocol 2 and Password SSH
    • $ sudo yum install -y nano
    • $ sudo nano /etc/ssh/sshd_config
      • PermitRootLogin no
      • Protocol 2
      • PasswordAuthentication no
    • $ sudo service sshd restart
    • Ensure you can still SSH back into the box using your key only.
  • Update packages
    • $ sudo yum upgrade
  • Reboot
    • $ sudo reboot

Shamans Harvest, Daughtry and Nickelback at Starlight

Nickelback is one of those bands that people always bag on but they continue to make and sell records. It’s weird. Angie and I went to see Shaman’s Harvest, Daughtry and Nickelback at Starlight for $25 Groupon, yes score!

First up was Shaman’s Harvest a local bunch (from Jefferson City, MO) that had a fair amount of fans in the audience.

They sounded solid, in time, and strong. It was interesting to listen to Nathan Hunt (lead singer) talk as he is clearly back woods – nothing wrong with that but I didn’t expect that from a hard rock genre band. They played about 30 minutes, and the stage was set for Daughtry:

They hit the stage running and thank goodness Chris’ voice is still as spot on as it was (during my memory anyway) as American Idol. I would vote a couple of the tunes they played were borderline prog-rock, note the keyboardist over on the left side:

In case you didn’t notice it was very bright still out and there were a ton of open seats:

Daughtry was on for about an hour. Playing one of their new songs from an upcoming album I was taken back from the sound. Not like their other stuff almost a reggae drum groove. It was good just different I thought. Onto the Nickelback set:

Finally started getting dark and about 2100 Nickelback hit the stage. They for some reason kept their stage gear wrapped up till about 1 minute before they started the show, I guess to keep suspense up on the color/look. The production level was high, the sound was dead on, I was impressed by the first couple of numbers.

The video screen in the back was really impressive quality, it showed videos during songs and every so often would show live feed from the side screens:

Again the production quality was great, here is a really crappy video showing some of the light show:

Towards the end of the show Kroeger asked Daughtry to come out and sing a couple of songs. I couldn’t tell if Kroeger was just tired of singing these on tour or if he really wanted to show everyone that Daughtry sings better than him. At any rate it was interesting to watch:

Towards the end of the set Kroeger invited a couple of folks up on the stage and asked them to sing, it wasn’t as bad as you would think.

Overall it was a concert I enjoyed especially for the price point.

All that being said what was my one negative take away. Chad Kroeger comes across as a huge prick. He was rude to his crew, really REALLY snotty to others on stage, and kept insulting people in the crowd. I just kept thinking “geez what an ass” through their whole set.

Me and Angie sitting in the sun (she is wearing her Wolfmother shirt from Granada):