Return the length of a string easily in C.

This simple code will return the length of a string easily. #include <stdio.h> #include <stdlib.h>   int main (void) { char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; int len_str;   // calculates length of string len_str = sizeof(base64) / sizeof(base64[0]); printf("%d\n", len_str); return 0; }#include <stdio.h> #include <stdlib.h> int main (void) { char…

Read More

Unneeded uproar over changes to Linux.

There are a few people who are upset over the changes to the Linux management. I.e the new code of conduct and the manager of the Linux kernel. Linux will not be affected, it is still the same Linux kernel and the same code, it will just be managed by…

Read More

The KDE Trinity desktop has all of the classic themes.

The KDE Trinity desktop has all of the good themes that users of KDE 2.2 would remember. These are great themes, there was another KDE theme I miss from the olden days. It was a stone look-alike theme that was very nice, but I cannot find it on the Internet….

Read More

KDE 3 is back. I am running Trinity desktop and loving it.

This is the Ubuntu distribution running the Trinity desktop for Linux. This is a reworking of KDE 3 to operate on a modern Linux distribution. I added this to my /etc/apt/sources.lst for Ubuntu 18.04. deb http://mirror.ppa.trinitydesktop.org/trinity/trinity-r14.0.0/ubuntu bionic main deb http://mirror.ppa.trinitydesktop.org/trinity/trinity-builddeps-r14.0.0/ubuntu bionic main deb-src http://mirror.ppa.trinitydesktop.org/trinity/trinity-r14.0.0/ubuntu bionic main deb-src http://mirror.ppa.trinitydesktop.org/trinity/trinity-builddeps-r14.0.0/ubuntu bionic maindeb…

Read More

How to best encode a video for Youtube on Linux.

This simple one-liner will encode a video to a format suitable for Youtube. 4.4 Tue Sep 04 jason@Yog-Sothoth 0: $ ffmpeg -i scorcher.avi -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart scorcher.mp4 This gives good quality output whilst…

Read More

Very useful bash PS1 prompts.

A very colorful example that will really stand out. 4.4 Wed Aug 29 jason@Yog-Sothoth 0: $ Here is the code for this example. export PS1="\[\033[38;5;39m\]\v\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;83m\]\d\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;201m\]\u\[$(tput sgr0)\]\[\033[38;5;196m\]@\[$(tput sgr0)\]\[\033[38;5;51m\]\H\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;82m\]\l\[$(tput sgr0)\]\[\033[38;5;15m\]: \\$ \[$(tput sgr0)\]"export PS1="\[\033[38;5;39m\]\v\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;83m\]\d\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;201m\]\u\[$(tput sgr0)\]\[\033[38;5;196m\]@\[$(tput sgr0)\]\[\033[38;5;51m\]\H\[$(tput sgr0)\]\[\033[38;5;15m\]…

Read More

Why a website should use SSL in this day and age.

The benefits of using an SSL certificate are many in this day and age, the immediate boost to your website is the trust gained by users that data entered on the website is secure. This is why bank websites use SSL and Site Seal to display a green padlock, and…

Read More

Mess with video playback in mpv.

Play a video in the mpv player and move the video frame partly off the screen. jason@Yog-Sothoth » ~ » $ mpv dvb://"SBS ONE HD(SBS)" –video-pan-y=-0.2 –video-pan-x=-0.2 This is a more extreme example. Play a video stream and only a small corner of it is visible. jason@Yog-Sothoth » ~ »…

Read More

Fix very slow Internet on Ubuntu 18 easily.

My Internet connection in Ubuntu 18 was very slow compared to Windows 8.1. This is how I fixed it. Run this command to open the /etc/resolv.conf file for editing. If you do not have VIM installed, try nano instead. Or run sudo apt install vim-common. jason@Yog-Sothoth » ~ » $…

Read More

How to setup a simple qemu VM and use networking.

This script will run a qemu VM and setup networking easily. This is very simple. 1 #!/bin/sh 2 3 export QEMU_AUDIO_DRV=alsa 4 DISKIMG=~/win7.img 5 WIN7IMG=~/Downloads/win7.iso 6 VIRTIMG=~/Downloads/virtio-win-0.1-81.iso 7 qemu-system-x86_64 –enable-kvm -drive file=${DISKIMG},if=virtio -m 4096 \ 8 -net nic,model=virtio -net user -cdrom ${WIN7IMG} \ 9 -drive file=${VIRTIMG},index=3,media=cdrom \ 10 -rtc base=localtime,clock=host…

Read More

Returning just the interface name with Linux.

The network adapter name is easy to return on Linux. This simple one-liner will give this information to the user. jason@Yog-Sothoth » ~ » $ ip -o -4 route show to default | awk '{print $5}' enp0s25 Using this information to get information about a network adapter. jason@Yog-Sothoth » ~…

Read More

Arma 3 script samples for creating a scripted mission.

This simple script sample will spawn 3 enemy groups around a central point in safe places. Fixed version, I accidentally posted the wrong code, this will work fine. I tested this in a mission and it works now. _Center = _randPos2; _Circle1 = [_Center, 150, 150, 0, 0, 20, 0]…

Read More

Very old but interesting UNIX and Linux documentation.

Very old, but precious UNIX documentation from the 1970`s. These would be very interesting reading for someone interested in UNIX. 1972 UNIX programming manual. https://www.tuhs.org//Archive/Distributions/Research/1972_stuff/unix_2nd_edition_manual.pdf. Tmg compiler-writing language manual. https://www.tuhs.org//Archive/Distributions/Research/1972_stuff/tmg.pdf. UNIX Programmers manual November 1971. https://www.tuhs.org//Archive/Distributions/Research/Dennis_v1/UNIX_ProgrammersManual_Nov71.pdf. UNIX Kernel Subroutine Descriptions March 1972. https://www.tuhs.org//Archive/Distributions/Research/Dennis_v1/Kernel_Subroutine_Descriptions_Mar72.pdf. Intro on how manual pages are laid…

Read More

Very nice bash PS1 prompts.

A complex, but very useful bash shell prompt. PS1=$( sep=$'\xC2\xBB' # UTF-8 U+00BB red=$(tput setaf 1) green=$(tput setaf 2) yellow=$(tput setaf 3) blue=$(tput setaf 4) cyan=$(tput setaf 5) bold=$(tput bold) reset=$(tput sgr0) [[ $EUID -eq 0 ]] && user=$red || user=$green echo "\[$user\]\u@\h\[$reset\] \[$blue$bold\]$sep\[$reset\] \[$yellow\]\W\[$reset\] \[$blue$bold\]$sep\[$reset\] \[$user\]\$\[$reset\] ") Gives the…

Read More

Make XfCE 4 look like a SGI O2 workstation.

Make your XFCE desktop look as close as possible to an old IRIX machine. SGI Screen Fonts https://www.gnome-look.org/p/998527/ Xfwm4 theme that is based on the window manager for SGI OS. https://www.gnome-look.org/p/1015906/ SGI-IMD Metacity theme. This also works with MATE. https://www.gnome-look.org/p/1006689/ SGI Irix cursor theme. This works with any window manager….

Read More