Personal site

Dark mode


23 Oct, 2024

Purge Git commits

Simply do the following.

git rebase -i // -i is interactive, can also throw in 'HEAD~2' to filter only the last 2 commits

git push -f origin main

16 Sept, 2024

Mount server folders as network drive

Temporary way

In Thunar folder window, navigate to the below.

sftp://USERNAME@HOSTNAME/

Fstab option

I could add this to Fstab but I rarely need to connect via folders.

sftp#USERNAME@HOSTNAME:/ /media/SftpShare fuse.sshfs user=USERNAME,identity=/path/to/private/key 0 0

24 Aug, 2024

SQL connect from remote

User creation

CREATE USER 'user'@'%' IDENTIFIED BY 'password';

GRANT CREATE ON *.* TO 'user'@'%';

FLUSH PRIVILEGES;

Edit address

sudo vim /etc/mysql/mariadb.conf.d/50-server.cnf

bind-address = 0.0.0.0

sudo systemctl restart mariadb

12 Jun, 2024

Backing up and restoring MariaDB SQL database via CLI

Backing up a single DB

sudo mysqldump -u root -p db_name > db_name.sql

Restore a single DB

First, create a database on the target machine using mysql.

sudo mysql -u root
create database database_name;
exit;

Then restore the backup to your database

mysql -u root -p database_name < db_name.sql

Note

When working on updating data, create a temporary table to run queries on. This acts as a safeguard.

09 Jun, 2024

Updating Ollama

Either update the binary, or run the fresh install command.

Fresh install method

If updating via the install method, ensure that the IP address is set in the /etc/systemd/system/ollama.service file.

curl -fsSL https://ollama.com/install.sh | sh

[Service]
Environment="OLLAMA_HOST=0.0.0.0"

sudo systemctl daemon-reload

Replacing the binary

sudo systemctl stop ollama.service

sudo curl -L https://ollama.com/download/ollama-linux-amd64 -o /usr/bin/ollama
sudo chmod +x /usr/bin/ollama

sudo systemctl start ollama.service

02 Apr, 2024

Docker WebUI command

docker run -d -p 3000:8080 -e OLLAMA_BASE_URL=http://localip:11434 -v /home/localfolder:/app/backend/data/docs -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main

30 Jan, 2024

Rosco M68K machine

Note: remember to use the below when connecting.

sudo minicom -D /dev/ttyUSB0 -c on -R utf-8
// Also note that the reset button is broken, insert and setup serial cable *then* power up.

21 Jan, 2024

FOSDEM 2024

I've booked my trip to FOSDEM again since I really enjoyed it last year. It was full of interesting talks, though I mostly stayed in the LLVM room. However since talks are recorded it's easy enough to catch up on missed sessions.

This year I plan on looking at the following;

Just like last year it will be nice to meet up with a few friends, I can see the FOSDEM trip becoming quite regular.

8 Dec, 2023

MacOS gcli test

Remember this needs adding to the configure for make check to work.

./configure PKG_CONFIG_PATH=/opt/homebrew/include/ PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig

30 Nov, 2023

Image resizer and rename script

I needed a way to resize 80 images for my AI assignment. For the reisizing I used Imagemagick.

echo magick mogrify -resize 150x150 -quality 100 -path ../../StageX *.JPG

Then for the resizing I used a bash script.

#!/bin/bash

folder_path="$PWD"

prefix="Stage_$1_"
student_no="XX"

cd "$folder_path"

for file in *.JPG; do
    if [[ -f "$file" ]]; then
        new_name="$prefix$student_no.jpg"
        i=1
        while [[ -e "$new_name" ]]; do
            new_name="${prefix}${student_no}_${i}.jpg"
            ((i++))
        done
        mv "$file" "$new_name"
        echo "Renamed '$file' to '$new_name'"
    fi
done

Run jupyter notebook via cli

jupyter nbconvert --to python NOTEBOOKNAME.ipynb
# Then run it with python
python NOTEBOOKNAME.py

27 Nov, 2023

FreeBSD RPI VM

Installed FreeBSD 14 under QEMU on one of my RaspberryPi's. It's nice now to have a ZFS image ready to use straight away.

24 Nov, 2023

MacOS Brew packages

A few days ago I was playing around with the Brew packaging system which looks seemed fairly easy to setup. The only issue that I have is the requirement of testing on x86 MacOS, aarch64 MacOS and Linux. I can understand the last 2 however having access to both x86 MacOS and aarch64 MacOS is tricky. The only thing I could do would be to test under a VM. Also the other tricky part I had issue with was the install section.

/opt/homebrew/Library/Taps/gcli

gcli@2.0.0.rb
 Formula cat gcli@2.0.0.rb
class GcliAT200 < Formula
  desc "Simple and portable CLI tool for interacting with GitHub, GitLab and Gitea"
  homepage "https://herrhotzenplotz.de/gcli/"
  url "https://github.com/herrhotzenplotz/gcli/archive/refs/tags/2.0.0.tar.gz"
  sha256 "61b28c1f240f9daf3d98d8aa0d6064d589302276659675ab3d2823dc20f53088"
  license "BSD-2-Clause"
  head "https://github.com/herrhotzenplotz/gcli.git", branch: "trunk"

  depends_on "make" => :build
  depends_on "autoconf"
  depends_on "automake"
  depends_on "bison"
  depends_on "curl"
  depends_on "flex"
  depends_on "libtool"
  depends_on "m4"
  depends_on "pkg-config"

  def install
    system "./autogen.sh"
    system "./configure"
    system "make"
    system "make", "install"
  end

  test do
    system "gcli", "--version"
  end
end

12 Oct, 2023

SSH security

Got recommended a site which audits sshd_config settings. Turns out I had old options turned on which should have been turned off.

https://www.sshaudit.com

The below block vastly secures ssh alongside other tweaks I have done on the backend.

KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group18-sha512,diffie-hellman-group16-sha512
Ciphers aes256-gcm@openssh.com,aes128-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com
HostKeyAlgorithms ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519

20 June, 2023

Vim Regex notes

# Replaces '()' with ''
:%s/()//g

# Removes lines containing .[0-9]G or Football
# Eg 12.9G
:g/.[0-9]K/d
:g/Football/d

# Replaces ' ' with '\ '
# Eg Wonders\ of\ the\ Ancient\ World
:%s/ /\\ /g

# Strips trailing whitespace
:%s/\s\+$//e


/g global
/gc asks for confirmation
/i case insensitive
/I case sensitive

Vim intent formatter

=G

03 April, 2023

SSD powered PI's!

I recently bought new 1TB SSD's for both RPI's. Currently the 4GB ram one is running my IRC within a Tmux window and the site which acts as my gateway to other machines. The 8GB pi has changed it's purpose.

Retro gaming!

Yep the 8GB has now become a bedroom retro gaming station! I've got it hooked up to a 4k TV where I can browse the web, watch a film, code or play some retro games! That's the best thing about the RPI's they can be placed into the corner of a room and you have a cheap multipurpose pc/server running all day long!

06 March, 2023

FreeBSD RPI4

My Gentoo HDD gave up, Raw Read Error Rates were sky high and it finally died. I decided to give FreeBSD another go on a small Hitachi 160GB drive. So far it runs flawlessly, which I expect nothing less. I do run FreeBSD on a qemu VM on my Macbook M1 which also runs perfectly. It's nice to have a proper unix system around.

10 February, 2023

FOSDEM and France

So I visited a friend in France on the 2nd and 3rd which was nice to finally put a face to a name and have it to where I don't feel like I'm talking to just chat AI. Something happened with Macrons wife and a restaurant that doesn't know how to make an Irish coffee. That was fun.

Then visited FOSDEM in Brussels which was also really good as I met up with 3 other people. Again to put some faces to names and have a good old chat about stuffs.

Not one interaction was awkward, oh even sat at a sushi restaurant with a bunch of arm guys who where running the LLVM room.

3 December, 2022

New Gentoo install instructions

For this instillation I boot from some Debian based OS from an SD card.

fkdisk                                                                                                                                 
Disk /dev/sda: 1.84 TiB, 2000398934016 bytes, 3907029168 sectors                                                                       
Disk model: 015-2E8174                                                                                                                 
Units: sectors of 1 * 512 = 512 bytes                                                                                                  
Sector size (logical/physical): 512 bytes / 4096 bytes                                                                                 
I/O size (minimum/optimal): 4096 bytes / 4096 bytes                                                                                    
Disklabel type: dos                                                                                                                    
Disk identifier: 0xda77a68a                                                                                                            
                                                                                                                                       
Device     Boot    Start        End    Sectors  Size Id Type
/dev/sda1           2048    8390655    8388608    4G  c W95 FAT32 (LBA)
/dev/sda2        8390656   25167871   16777216    8G 82 Linux swap / Solaris
/dev/sda3       25167872 3907029167 3881861296  1.8T 83 Linux
 
                                                                                                                                       
mkfs.vfat -F 32 /dev/sda1                                                                                                              
mkswap /dev/sda2                                                                                                                       
mkfs.ext4 /dev/sda3                                                                                                                    
                                                                                                                                       
                                                                                                                                       
mkdir /mnt/gentoo                                                                                                                      
mount /dev/sda3 /mnt/gentoo                                                                                                            
mkdir /mnt/gentoo/boot/                                                                                                                
mount /dev/sda1 /mnt/gentoo/boot                                                                                                       


cd /tmp/
wget https://bouncer.gentoo.org/fetch/root/all/releases/arm64/autobuilds/20221127T233152Z/stage3-arm64-openrc-20221127T233152Z.tar.xz
tar xvf stage3-arm64-20210206T004741Z.tar.xz -C /mnt/gentoo/


wget http://distfiles.gentoo.org/snapshots/portage-latest.tar.bz2
tar xvf portage-latest.tar.bz2 -C /mnt/gentoo/usr


cp --dereference /etc/resolv.conf /mnt/gentoo/etc/

mount --types proc /proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --make-rslave /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
mount --make-rslave /mnt/gentoo/dev
mount /dev/sda1 /boot *check either sda or sdb*


chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) ${PS1}"


emerge-webrsync
nano /etc/locale.gen
en_US.UTF-8 UTF-8
en_GB.UTF-8 UTF-8
locale-gen

(chroot) pi64 / # eselect locale list
Available targets for the LANG variable:
[1]   C
[2]   C.utf8
[3]   POSIX
[4]   en_GB.utf8
[5]   C.UTF8 *
[ ]   (free form)
(chroot) pi64 / #
(chroot) pi64 / # eselect locale set 4


nano /etc/portage/make.conf
MAKEOPTS="-j5 -l4"
USE="-kde -gnome -systemd v3d vc4"
CFLAGS="-march=armv8-a+crc+simd -mtune=cortex-a72 -ftree-vectorize -O2 -pipe -fomit-frame-pointer"


emerge --ask --verbose --update --deep --newuse --changed-use @world
rc-update add sshd default
emerge --ask -q net-misc/ntp net-misc/dhcpcd dev-vcs/git htop app-portage/gentoolkit genlop \
media-libs/raspberrypi-userland vim tmux net-misc/chrony dev-util/cmake sys-libs/timezone-data
rc-update add chronyd
rc-update del hwclock boot
rc-update add swclock boot
rc-service ntp-client start
rc-update add ntp-client default
rc-service ntpd start
rc-update ntpd start default


vim /etc/shadow
root:$6$xxPVR/Td5iP$/7Asdgq0ux2sgNkklnndcG4g3493kUYfrrdenBXjxBxEsoLneJpDAwOyX/kkpFB4pU5dlhHEyN0SK4eh/WpmO0::0:99999:7:::
password = raspberry


cd /boot
git clone --depth 1 https://github.com/raspberrypi/firmware/
cd firmware/boot
cp -r * /boot/
cp -r ../modules /lib/


vim /etc/fstab
/dev/sda1               /boot           auto            noauto,noatime  1 2
/dev/sda2               none            swap            sw              0 0
/dev/sda3               /               ext4            noatime         0 1


vim /boot/config.txt
# have a properly sized image
disable_overscan=1

# lets have the VC4 hardware accelerated video
dtoverlay=vc4-fkms-v3d

# for sound over HDMI
hdmi_drive=2

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

# gpu_mem is for closed-source driver only; since we are only using the
# open-source driver here, set low
gpu_mem=16

# Force booting in 64bit mode
arm_64bit=1


vim /boot/cmdline.txt
console=serial0,115200 console=tty1 root=/dev/sda3 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait


cd /etc/init.d/
ln -sv net.lo net.eth0
rc-service net.eth0 start
rc-update add net.eth0 boot
rc-update add sshd boot
rc-update add net.eth0 default

root # rc-update --update


exit


cp /mnt/gentoo/usr/share/zoneinfo/Europe/London /mnt/gentoo/etc/localtime
echo "Europe/London" > /mnt/gentoo/etc/timezone


cd
umount -l /mnt/gentoo/dev{/shm,/pts,}
umount -R /mnt/gentoo
shutdown -h now

2 December, 2022

New Gentoo machine

So I recently bought another RaspberryPi but the 8GB version. It'll only run Gentoo using a 2TB 2.5HDD via USB3 to SATA.

Linux muninn 5.15.80-v8+ #1602 SMP PREEMPT Tue Nov 29 14:48:23 GMT 2022 aarch64 GNU/Linux

        -/oyddmdhs+:.                root@muninn
    -odNMMMMMMMMNNmhy+-`             -----------
  -yNMMMMMMMMMMMNNNmmdhy+-           OS: Gentoo Linux aarch64
`omMMMMMMMMMMMMNmdmmmmddhhy/`        Host: Raspberry Pi 4 Model B Rev 1.4
omMMMMMMMMMMMNhhyyyohmdddhhhdo`      Kernel: 5.15.80-v8+
.ydMMMMMMMMMMdhs++so/smdddhhhhdm+`    Uptime: 13 mins
oyhdmNMMMMMMMNdyooydmddddhhhhyhNd.   Packages: 324 (emerge)
 :oyhhdNNMMMMMMMNNNmmdddhhhhhyymMh   Shell: bash 5.1.16
   .:+sydNMMMMMNNNmmmdddhhhhhhmMmy   Resolution: 1920x1080
      /mMMMMMMNNNmmmdddhhhhhmMNhs:   Terminal: /dev/pts/0
   `oNMMMMMMMNNNmmmddddhhdmMNhs+`    CPU: ARM Cortex-A72 (4) @ 1.500GHz
 `sNMMMMMMMMNNNmmmdddddmNMmhs/.      Memory: 71MiB / 7862MiB
 /NMMMMMMMMNNNNmmmdddmNMNdso:`
+MMMMMMMNNNNNmmmmdmNMNdso/-
yMMNNNNNNNmmmmmNNMmhs+/-`
/hMMNNNNNNNNMNdhs++/-`
`/ohdmmddhys+++/:.`
 `-//////:--.

Now to throw it into a corner and let it compile firefox, xorg, gcc and llvm for a few days.

22 June, 2022

RC2014 Emulator

I'm using this to emulate my RC2014. Once compiled and the image has been created I just run the below.

./rc2014 -p -i my.cf -s -r 24886009.BIN -e 2

To exit emulator do Ctrl+\

17 June, 2022

RC2014 Terminal

I feel C-Kermit is a better way to interact with my RC2014 than gtkterm, so I use the below commands to connect when plugged in through a serial connection.

sudo ckermit
set line /dev/ttyUSB__
set speed 115200
connect

C-Kermit should be available with most package managers.

27 May, 2022

RC2014 Mini + CP/M Z80

Some commands for reference.

sudo gtkterm

cpm

$HOME/git_repos/cpm-uploader
sudo ./upload.rb --file $HOME/Downloads/Foxhollow-cpm/packages/wordstr4.pkg

a:depkg wordstr4.pkg

# era (erase)
era wordstr4.pkg

# Moving around just do 
a: or b: etc (up to p:)

13 May, 2022

Mullvad Wireguard cli

sudo apt update && sudo apt install openresolv wireguard
wg-quick up mullvad-se4
wg-quick down mullvad-se4
systemctl enable wg-quick@mullvad-se4

# Ensure .conf file is in /etc/wireguard/

5 February, 2022

Updating dns for a namecheap site on the RaspberryPi on FreeBSD

On the site choose dynamic dns with the type to a+ Dynamic DNS Record and the host to @. Set the host records to the same thing.

Install ddclient from ports then edit the below file on the server as below for an automatic resolver.

/usr/local/etc/ddclient.conf 

use=web, web=dynamicdns.park-your-domain.com/getip
protocol=namecheap
server=dynamicdns.park-your-domain.com
login=WEBSITEDOMAIN.COM
password=GENERATED DNS PASSWORD HERE
@

For multiple domains do the below.

use=web, web=dynamicdns.park-your-domain.com/getip
protocol=namecheap
server=dynamicdns.park-your-domain.com

# Domain 1
login=WEBSITEDOMAIN1.COM
password=GENERATED DNS PASSWORD HERE
@.WEBSITEDOMAIN1.COM

# Domain 2
login=WEBSITEDOMAIN2.COM
password=GENERATED DNS PASSWORD HERE
@.WEBSITEDOMAIN2.COM

ddclient home page gate io bonus

namecheap dynamic dns help page namecheap dynamic dns help page 2

28 September, 2021

Using multiple git accounts on one machine.

Generate a separate key first.

ssh-keygen -t ed25519 -C "user@example.com"

# When saving to location I advise saving to separate name instead of default eg

~/.ssh/new_account

Then add this line to .gitconfig.

[includeIf "gitdir:~/$HOME/git_repo_folder/"]
path = .gitconfig-whatever

Create new .gitconfig-whatever with the below.

[user]
name = Username
email = user@example.com

[core]
sshCommand = ssh -i ~/.ssh/new_account

Add the key to ssh-agent.

eval "$(ssh-agent -s)"

ssh-add ~/.ssh/new_account

# Edit .ssh/config

Host new_account
  HostName github.com
  User git 
  IdentityFile ~/.ssh/new_account
  UseKeychain yes

ssh-add ~/.ssh/new_account

Add the new ssh key to git and test it.

ssh -T git@github.com
Hi user! You've successfully authenticated, but GitHub does not provide shell access.

9 September, 2021

Gentoo updating kernel

Small note to self, an easy way to uptate to latest rpi gentoo kernel I could just set sys-kernel/raspberrypi-image and sys-boot/raspberrypi-firmware to verson 9999. This could be done by editing /etc/portage/package.accept_keywords.

23 August, 2021

Re-building vmware modules

sudo vmware-modconfig --console --install-all

22 August, 2021

Mapping Wacom tablet to primary screen

Using just xrandr to list connected devices will show every display device. So to only use the primary screen as the wacom surface do the bellow.

xrandr | grep 'primary'
DP-3 connected primary 1920x1080+1920+0 (normal left inverted right x axis y axis) 477mm x 268mm

xinput | grep -i Wacom
⎜   ↳ Wacom Intuos Pro M Pen stylus             id=18   [slave  pointer  (2)]
⎜   ↳ Wacom Intuos Pro M Pen eraser             id=19   [slave  pointer  (2)]
⎜   ↳ Wacom Intuos Pro M Pad pad                id=20   [slave  pointer  (2)]
⎜   ↳ Wacom Intuos Pro M Finger touch           id=21   [slave  pointer  (2)]

This shows the primary display as DP-3 and the Wacom id's range from 18-21, so you just need to re-map the device to the display.

xinput map-to-output 18 DP-3
xinput map-to-output 19 DP-3
xinput map-to-output 20 DP-3
xinput map-to-output 21 DP-3

It's that easy.

Note I have yet to reboot so my guess is that this is just a temporary solution.

29 July, 2021

Custom Proton builds

Dump them here.

$HOME/.steam/root/compatibilitytools.d/

31 March, 2021

RPI 4

Finally got a proper kernel running and vc4 runs like clockwork.

Notes on updating the Gentoo Rpi Kernel

mount /dev/sda1 /boot

edit /etc/portage/accept.keywords genkernel value for kernel no
eselect kernel list #ensure new kernel sources are still there
eselect kernel set .. #set it

cd /usr/src/linux

make bcm2711_defconfig - 5.10.22 has this config
OR
make oldconfig

make menuconfig - check check check
make -j4 Image modules dtbs 
make modules_install dtbs_install 

mount /dev/sda1 /boot

cp arch/arm64/boot/Image /boot/kernel-....v8-p4-bis-gdb1.img

#ensure /boot/config.txt has the below

kernel=kernel-....v8-p4-gdb1.img


*if new initramfs is needed*
dracut
dracut --kver ....-v8-p4-bis

initramfs=initramfs-....-v8-p4-bis-gbd1.img

Chrooting use below (note must be using arm64 to chroot on arm64).

mkdir /mnt/gentoo
mount /dev/sdb3 /mnt/gentoo
mount /dev/sdb1 /mnt/gentoo/boot
mount --types proc /proc /mnt/gentoo/proc 
mount --rbind /sys /mnt/gentoo/sys 
mount --make-rslave /mnt/gentoo/sys 
mount --rbind /dev /mnt/gentoo/dev 
mount --make-rslave /mnt/gentoo/dev

chroot /mnt/gentoo /bin/bash
source /etc/profile 
export PS1="(chroot) ${PS1}"

umount -l /mnt/gentoo/dev{/shm,/pts,} 
umount -R /mnt/gentoo

References

Build-an-RPi4-64bit-Kernel-on-the-RPi Raspberry Pi4 64 Bit Install#The Pi 4 kernel Raspberry Pi/Kernel Compilation Upgrade#Reinstalling external kernel modules

22 March, 2021

Misc updates

Vim spellchecking

Extract from here

27 February, 2021

Pandoc not required

So it turns out I can't get Pandoc running on the Gentoo Raspberry Pi so I looked into other ways of rendering my markdown file to html. cmark.

rm index.html && cmark --unsafe -t html diary.md >> index.html

16 February, 2021

XTerm BDF font install Debian

sudo cp -r $HOME/fontdir /usr/share/fonts #for systemwide usage
sudo chmod -r 777 /usr/share/fonts/fontdir
sudo chown -R root:root /usr/share/fonts/fontdir
cd /usr/share/fonts/fontdir
mkfontscale && mkfontdir
xset +fp /usr/share/fonts/fontdir
xset fp rehash

To find newly installed fonts.

xlsfonts | grep fontdir

Then you can add it to your .Xresources file and reload xterm.

xrdb -load ~/.Xresources

11 February, 2021

rsync backup to hdd for Gentoo

Backup to external hdd use the below.

sudo rsync -aAXv --delete --exclude=/dev/* --exclude=/proc/* --exclude=/sys/* --exclude=/tmp/* --exclude=/run/* --exclude=/mnt/* --exclude=/media/* --exclude="swapfile" --exclude="lost+found" --exclude=".cache" /source /destination

The option --dry-run can be used to simulate the backup process.

To restore system use this.

sudo rsync -aAXv --delete --exclude="lost+found" /backup /system

Gentoo install notes

    parted table
    Model: ASMT ASM1156-PM (scsi)                                          
    Disk /dev/sdb: 250GB                                                   
    Sector size (logical/physical): 512B/512B                              
    Partition Table: msdos                                                 
    Disk Flags:                                                            
    
    Device     Boot    Start       End   Sectors   Size Id Type
    /dev/sdb1  *       65535   1114094   1048560   512M  c W95 FAT32 (LBA)
    /dev/sdb2        1114095  17891054  16776960     8G 82 Linux swap / Solaris
    /dev/sdb3       17891055 488397167 470506113 224.4G 83 Linux
                                                                    

    mkfs.vfat -F 16 /dev/sda1
    mkswap /dev/sda2
    mkfs.ext4 /dev/sda3


    mkdir /mnt/gentoo
    mount /dev/sdb3 /mnt/gentoo
    mkdir /mnt/gentoo/boot/
    mount /dev/sdb1 /mnt/gentoo/boot 


    cd /tmp/
    wget https://bouncer.gentoo.org/fetch/root/all/releases/arm64/autobuilds/20210206T004741Z/stage3-arm64-20210206T004741Z.tar.xz   
    tar xvf stage3-arm64-20210206T004741Z.tar.xz -C /mnt/gentoo/ 


    wget http://distfiles.gentoo.org/snapshots/portage-latest.tar.bz2
    tar xvf portage-latest.tar.bz2 -C /mnt/gentoo/usr 


    cp --dereference /etc/resolv.conf /mnt/gentoo/etc/

    mount --types proc /proc /mnt/gentoo/proc
    mount --rbind /sys /mnt/gentoo/sys
    mount --make-rslave /mnt/gentoo/sys
    mount --rbind /dev /mnt/gentoo/dev
    mount --make-rslave /mnt/gentoo/dev 
    mount /dev/sdb1 /boot *check either sda or sdb*

    chroot /mnt/gentoo /bin/bash
    source /etc/profile
    export PS1="(chroot) ${PS1}"

    emerge-webrsync
    nano /etc/locale.gen
    locale-gen


    (chroot) pi64 / # eselect locale list
    Available targets for the LANG variable:
    [1]   C
    [2]   C.utf8
    [3]   POSIX
    [4]   en_GB.utf8
    [5]   C.UTF8 *
    [ ]   (free form)
    (chroot) pi64 / # 
    (chroot) pi64 / # eselect locale set 4

    nano /etc/portage/make.conf
    MAKEOPTS="-j5 -l4"
    USE="-kde -gnome -systemd -wifi"
    CFLAGS="-march=armv8-a+crc+simd -mtune=cortex-a72 -ftree-vectorize -O2 -pipe -fomit-frame-pointer"

    emerge --ask --verbose --update --deep --newuse @world
    rc-update add sshd default
    emerge --ask net-misc/ntp
    rc-update add ntp-client default 
    emerge --ask media-libs/raspberrypi-userland 

    nano /mnt/gentoo/etc/shadow
    root:$6$xxPVR/Td5iP$/7Asdgq0ux2sgNkklnndcG4g3493kUYfrrdenBXjxBxEsoLneJpDAwOyX/kkpFB4pU5dlhHEyN0SK4eh/WpmO0::0:99999:7:::
    password = raspberry

    cd /boot
    git clone --depth 1 git://github.com/raspberrypi/firmware/
    cd firmware/boot
    cp -r * /mnt/gentoo/boot/
    cp -r ../modules /mnt/gentoo/lib/


    nano /mnt/gentoo/etc/fstab 
    /dev/sda1		/boot		auto		noauto,noatime	1 2
    /dev/sda3		/		ext4		noatime		0 1
    /dev/sda2		none		swap		sw		0 0


    nano /mnt/gentoo/boot/config.txt

    # have a properly sized image
    disable_overscan=1

    # lets have the VC4 hardware accelerated video
    dtoverlay=vc4-fkms-v3d

    # for sound over HDMI
    hdmi_drive=2

    # Enable audio (loads snd_bcm2835)
    dtparam=audio=on

    # gpu_mem is for closed-source driver only; since we are only using the
    # open-source driver here, set low
    gpu_mem=16

    # Force booting in 64bit mode
    arm_64bit=1

    cd /etc/init.d/
    ln -sv net.lo net.eth0
    rc-service net.eth0 start
    rc-update add net.eth0 boot
    rc-update add sshd boot

    root # rc-update --update 

    nano /mnt/gentoo/boot/cmdline.txt 
    console=serial0,115200 console=tty1 root=/dev/sda3 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait


    cp /mnt/gentoo/usr/share/zoneinfo/Europe/London /mnt/gentoo/etc/localtime 
    echo "Europe/London" > /mnt/gentoo/etc/timezone 

    cd
    umount -l /mnt/gentoo/dev{/shm,/pts,}
    umount -R /mnt/gentoo
    shutdown -h now 

09 December, 2020

Convert to local time

To convert a different time zone to local time all I need to do is run one command.

date -d '2020-12-09 16:00 PST'
Thu 10 Dec 00:00:00 GMT 2020

19 October, 2020

Vim replace

Reminder to self, to replace words in VIM the syntax is.

:[range]s[ubstitute]/{pattern}/{string}/[flags] [count]

Here is an example to replace all words with 'yes' with 'no' but ask for confirmation for for each time.

:%s/yes/no/gc

11 October, 2020

Saving git login info

WARNING this saves your login details for git in a text file for global use. If you really want to use this I highly suggest creating a token instead of using your actual password.

 git config --global credential.helper store

16 August, 2020

ParrotOS

The default bookmarks in parrot are an awesome resource 10/10 for actually giving the information to beginners or to be used as quick references.

June 27, 2020

Blink shell on iOS

I wanted to find a way to SSH into my Tmux session whilst I was in another room or downstairs taking a break. Crawling the web led me to the Blink shell. Once installed and loaded up all I needed to do was setup a host by typing.

    blink> config

Then go into Hosts and add the server I wanted to load into. Also I needed to re-map my command key to something a little more comfortable on the iOS keyboard. Then from there it was super easy to use the terminal, it ran with no lag or issues what so ever.

June 23, 2020

Notes init