Pretty Git

Set the pretty format:

git log --color --graph --pretty=format:'%Cred%h%Creset %Cgreen(%cr) %C(bold blue)<%an>%Creset -%C(yellow)%d%Creset %s' --abbrev-commit

Create an alias:

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset %Cgreen(%cr) %C(bold blue)<%an>%Creset -%C(yellow)%d%Creset %s' --abbrev-commit"

REXX: credit card number generator and validator

This REXX program generates credit card numbers (16 digits – no Amex), checks if the number is valid using Luhn algorithm and prints it to OUTDD.

/**************************** REXX *********************************/

"FREE FI(outdd)"
"ALLOC FI(outdd) DA('Z00324.OUTPUT(CUST16)') SHR REUSE"

out_ctr = 0                    

valid_count = 0
DO WHILE (valid_count < 500)
  CALL GENERATE
  ccvalid.1 = randomcc
  CALL LUHN                   
    IF LUHN(ccvalid.1) THEN
      DO
        "EXECIO 1 DISKW outdd (STEM ccvalid. "
        out_ctr = out_ctr + 1        
        valid_count = valid_count + 1
      END
END
IF out_ctr > 0 THEN             
  DO                               
  "EXECIO 0 DISKW outdd (FINIS" 
  SAY 'File outdd now contains ' out_ctr' lines.'
END
ELSE                         
  DO                         
   "EXECIO 0 DISKW outdd (OPEN FINIS"  
   SAY 'File outdd is now empty.'
   END
"FREE FI(outdd)"
EXIT

GENERATE:
DO x=1 to 4 by 1
  randomdig.x = RANDOM(1000,9999)
END
randomcc = randomdig.1 || randomdig.2 ||  randomdig.3 || randomdig.4
RETURN

LUHN:                     
  sum=0                                
  even=0                               
    DO i=length(randomcc) TO 1 BY -1   
    c=SUBSTR(randomcc,i,1)             
  IF even THEN DO                      
    c=c*2                              
    IF c>=10 THEN                      
      c=c-9                            
    END                                
  even=\even                           
  sum=sum+c                            
  END
RETURN right(sum,1)=0                  

DisplayCAL on Fedora 34

DisplayCAL relies on Python2, which is not supported since Fedora 32.

You can download the required packages compiled for Fedora 31, that will work for versions 32/33/34:

  • python2-wxpython
  • puthon2-gobject-base
  • python2-gobject
  • DisplayCAL
wget https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Everything/x86_64/os/Packages/p/python2-wxpython-3.0.2.0-26.fc31.x86_64.rpm https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Everything/x86_64/os/Packages/p/python2-gobject-3.34.0-3.fc31.x86_64.rpm https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Everything/x86_64/os/Packages/p/python2-gobject-base-3.34.0-3.fc31.x86_64.rpm https://rpmfind.net/linux/fedora/linux/releases/31/Everything/x86_64/os/Packages/p/python2-gobject-3.34.0-3.fc31.x86_64.rpm https://displaycal.net/download/Fedora_31/x86_64/DisplayCAL.rpm

Creating ISO from CD

[compuk@mashiny] ~$ isoinfo -d -i /dev/cdrom 
CD-ROM is in ISO 9660 format
System id:
Volume id: MSCW02_I_01
Volume set id: MSCW02_I_01
Publisher id: MICROSOFT CORPORATION
Data preparer id: MICROSOFT CORPORATION, ONE MICROSOFT WAY, REDMOND WA 98052, (206) 882-8080
Application id: CDIMAGE V2.12 (01/24/96 TM)
Copyright File id:
Abstract File id:
Bibliographic File id:
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 188766

Joliet with UCS level 3 found
NO Rock Ridge present
[compuk@mashiny] ~$ dd if=/dev/cdrom of=~/Desktop/CreativeWriter2.iso bs=2048 count=188766 status=progress
384817152 bytes (385 MB, 367 MiB) copied, 172 s, 2,2 MB/s
188766+0 records in
188766+0 records out
386592768 bytes (387 MB, 369 MiB) copied, 172,618 s, 2,2 MB/s

Manually booting a Linux Kernel

After updating a server, rebooting it to load the new Kernel, removing the old Kernel and rebooting again, I got the GRUB minimal BASH-like prompt (I still can’t understand why, honestly), as if GRUB wasn’t able to see any info on how it should load the Kernel and the OS.

I know I could be very distracted but deleting all the Kernels seemed a little too much so I tried to manually boot the Kernel.

First, I checked what GRUB could see:

grub> ls
(hd0) (hd0,msdos1) (hd0,msdos2)

Listed the content of the disks to see what files were present and determine which one was the root filesystem:

grub> ls (hd0,1)/
lost+found/ vmlinuz-5.10.21-200... initramfs-5.10.21-200....img vmlinuz-0-rescue... initramfs-0-rescue....img

Set it as boot volume:

grub> root=(hd0,msdos1)

Loaded the Kernel image and RAM disk:

grub> linux /vmlinuz-5.10.21-200... root=/dev/sda1
grub> initrd initramfs-5.10.21-200....img

And finally booted the system:

grub> boot

Just in case, I also created a new GRUB config based on the currently running system:

grub2-mkconfig -o /boot/grub2/grub.cfg

macOS: changing hostname

Primary hostname:

sudo scutil --set HostName KittyBook

Bonjour hostname (network related):

sudo scutil --set LocalHostName KittyBook.compukitty.net

Computer name (you can also do this via GUI, in System Preferences):

sudo scutil --set ComputerName <new name>

Create CSR for a SAN certificate

SAN stands for Subject Alternative Names and it allows you to use a single certificate for multiple CN.

It’s different from a wildcard certificate because with a SAN certificate you can have multiple complete CN (e.g. byruit.io, elena.com).

First, you have to create a .conf file with this content:

[ req ]
default_bits       = 4096
distinguished_name = req_distinguished_name
req_extensions     = req_ext
prompt = no
[ req_distinguished_name ]
countryName                = Country Name (2 letter code)
stateOrProvinceName        = State or Province Name (full name)
localityName               = Locality Name (eg, city)
organizationName           = Organization Name (eg, company)
commonName                 = byruit.io
[ req_ext ]
subjectAltName = @alt_names
[alt_names]
DNS.1   = mail.compukitty.net
DNS.2   = monitor.compukitty.net
DNS.3   = compukitty.net
IP.1 = 10.130.8.7

The CN is the main domain you want to verify; ensure that this domain is also under the [alt_names]. You can add up to 250 domains.

Generate the CSR and KEY:

openssl req -new -out byruit.csr -newkey rsa:4096 -nodes -sha256 -keyout byruit.key -config san.conf

To verify the CSR:

openssl req -text -noout -verify -in byruit.csr