<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.0">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2021-09-24T04:50:53+00:00</updated><id>/feed.xml</id><title type="html">DeepBSD’s Blog</title><subtitle>This is my programmer's blog, where I write about what projects I'm working on and where I share the problems I'm working through.  However, I can also talk about my sysadmin tasks here on dsj.net, my local home network.</subtitle><entry><title type="html">Learning Bash</title><link href="/linux,/bash/2021/09/23/Learning_Bash.html" rel="alternate" type="text/html" title="Learning Bash" /><published>2021-09-23T18:05:27+00:00</published><updated>2021-09-23T18:05:27+00:00</updated><id>/linux,/bash/2021/09/23/Learning_Bash</id><content type="html" xml:base="/linux,/bash/2021/09/23/Learning_Bash.html">&lt;h1 id=&quot;how-learning-bash-helps-you-learn-linux&quot;&gt;How Learning Bash Helps you Learn Linux&lt;/h1&gt;

&lt;p&gt;When you set out to “Learn Linux” you’re actually embarking on a long journey of UNIX
mastery.  You’re joining a group of geeks whose ancestry goes back to the 1960’s, and
perhaps even before, if you consider that UNIX didn’t grow out of nothing.  Learning
the Bourne Again SHell will teach you long-standing principles that have served
programmers, admins, and geeks well since before 64k was a lot of memory up until
now.&lt;/p&gt;

&lt;p&gt;By the way, “UNIX” is a copyrighted product, but for many of us, “Unix” is a way of life. So 
I frequently use “Unix” to mean “Unix-like operating system” such as Linux.&lt;/p&gt;

&lt;h1 id=&quot;the-terminal-working-in-your-head-not-the-display&quot;&gt;The Terminal (Working In Your Head, Not the Display)&lt;/h1&gt;

&lt;p&gt;In this modern day and age, most people are used to graphical interfaces or GUIs.
The terminal feels like a foreign planet to most computer users nowadays.  But
graphical layers depend on many other programs and devices working correctly.  If any
of those go wrong, only a console or terminal might be available.  Even very simple
problems can cause a graphical layer to go away.  If you depend on only the graphical
layer, you will experience more downtime and won’t be able to fix many
not-so-difficult problems.&lt;/p&gt;

&lt;p&gt;The early computers didn’t have the horsepower to show graphical layers.  The first
computers didn’t even have keyboards or monitors, let alone mice.  Computer programs
used to be stored on perforated paper.  Even large floppy disks were an improvement.
And people got lots of work done in those days by doing mental work in their heads
instead of on the screen. So really, a terminal is a luxury!&lt;/p&gt;

&lt;p&gt;To make sense of the terminal, you have to understand how computers are built and how
they work.  You won’t be seeing pictures of a hard disk or power supply or keyboard.
You have to understand the basic hardware and ideas that make things work.  So this
article assumes you have that.  If you don’t know what a network connection or memory
card or disk drive is, you probably are not yet ready for Linux or Bash.  (Even the
term “card” and “disk” is starting to sound rather old.)&lt;/p&gt;

&lt;h1 id=&quot;keep-pieces-small-but-small-pieces-together-can-form-big-pieces&quot;&gt;Keep Pieces Small, But Small Pieces Together Can Form Big Pieces&lt;/h1&gt;

&lt;p&gt;One of the first principles of Unix is that programs are designed to be small and do
very specific things, but that these small programs can be joined together to do
large, sophisticated jobs using Unix plumbing.&lt;/p&gt;

&lt;p&gt;UNIX plumbing is a way of talking about redirecting input and output on the terminal.
The notion of data flowing in a direction from one thing to another thing is not new.
But in the terminal we constantly thing of STD_IN and STD_OUT and something else
called STD_ERR.  This is simply data flowing in, data flowing out, and then
something going wrong with the flow of data.&lt;/p&gt;

&lt;p&gt;Mind you, these small programs we’re talking about need data to work on.  Let’s
create a simple command at the terminal and print the word “Linux” to the display:
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;echo 'Linux'&lt;/code&gt; at the terminal will cause the STD_OUT to be “Linux”.&lt;/p&gt;

&lt;p&gt;To see an example of STD_IN you could take the STD_OUT of this command and “pipe”
it (UNIX plumbing term) so it becomes the STD_IN of another program (we’ll use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tr&lt;/code&gt;):
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;echo 'Linux' | tr a-z A-Z&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The end result of this is ‘LINUX’ at the prompt.  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;echo&lt;/code&gt; produces and STD_OUT of
‘Linux’.  Because of the pipe symbol ‘|’, this output now becomes the input to
another program called &lt;em&gt;tr&lt;/em&gt;.  This is a terrific little program which I encourage you
to read about.  It simply “translates” or “modifies” some textual input to
some kind of textual output.  It can do different things to characters in a string.
In this case, we’re replacing all lowercase characters with uppercase characters.
The STD_OUT of one program has become the STD_IN of another program using Unix
plumbing.  This is a very, very useful concept that happens a lot in Linux and Unix.&lt;/p&gt;

&lt;p&gt;You can stack up the commands in a sequence:
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;echo &quot;Linux&quot; | tr a-z A-Z | sed 's/LINU/UNI/'&lt;/code&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sed&lt;/code&gt; is a terrific and powerful program that edits streams of text. Here, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tr&lt;/code&gt; translates
the text to uppercase and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sed&lt;/code&gt; substitutes ‘LINU’ with ‘UNI’ to output the word
‘UNIX’ from the original ‘Linux’.&lt;/p&gt;

&lt;p&gt;We have taken STD_OUT from one program and piped into STD_IN of another program,
and then done the same thing again with &lt;em&gt;that&lt;/em&gt; output so it becomes STD_IN for yet
another program (sed) to produce yet another example of STD_OUT: ‘UNIX’.&lt;/p&gt;

&lt;p&gt;There are many, many more examples of plumbing with Linux with more operators.  The
pipe symbol is just one.  The point is, we’re using very small things to accomplish
large tasks by gluing the small things together.  This idea is fundamental to Bash
and Unix/Linux.&lt;/p&gt;

&lt;h1 id=&quot;reusing-small-and-useful-tools&quot;&gt;Reusing Small and Useful Tools&lt;/h1&gt;

&lt;p&gt;The plumbing examples above show off another very important principle:  reusing
common tools.&lt;/p&gt;

&lt;p&gt;Imagine you had a screwdriver that had an unlimited number of bits for it.  You could
use the same screwdriver on slot head screws as well as phillips head screws as well
as Torx head screw as well as anything else.  These small Unix/Linux tools are very
much like that.&lt;/p&gt;

&lt;p&gt;Let’s use some plumbing together with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tr&lt;/code&gt; command and show how flexible small
and reusable tools can be when used together:
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;echo 'I Love Linux' | tr a-z A-Z | tr -s ' ' '\n' | tr -d 'X' &amp;gt; ~/ilike.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This example reuses the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tr&lt;/code&gt; command to uppercase a string, to substitute newlines
for blank spaces, and to remove a character from the final string, before redirecting
the output to a filename in the user’s home directory (which is another example of
Unix/Linux plumbing).&lt;/p&gt;

&lt;p&gt;When you use this command, you won’t see anything on STD_OUT, because that output
has been redirected to a filename.  If you type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cat ~/ilike.txt&lt;/code&gt; then you’ll see the
output.  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tr&lt;/code&gt; has been reused three times in the same command, each with a unique
result.&lt;/p&gt;

&lt;p&gt;When you start using Bash, you may easily underestimate how flexible and re-usable
each of the simple commands can be in your day-to-day work.  Many of these small
commands will become indispensible tools you cannot live without each day.&lt;/p&gt;

&lt;h1 id=&quot;pre-eminance-of-text&quot;&gt;Pre-eminance of Text&lt;/h1&gt;

&lt;p&gt;You’ll notice that each of these commands uses text in STD_OUT and STD_IN.  That’s
by intention.  Linux/Unix depends on text files, not binary files so much.  There can
be individual programs in Linux/Unix that use binary files, but most of Linux/Unix
just use plain old text files.  You’ll edit your Bash programs with a simple text
editor.  It will create simple, flat text files.  The advantage to this is you can
easily fix things by altering text files.&lt;/p&gt;

&lt;p&gt;Computers break rather often.  Even when just doing routine maintenance, your system
will be in some sort of broken or semi-broken state.  If you depend on flat text
files to reconfigure and fix things, those are easy to repair even with a broken
system.  Text files can almost always be edited, even under severe breakage of a
system.  No special tools required.  This has been one of the most beloved aspects of
Unix:  text files are key.&lt;/p&gt;

&lt;p&gt;This implies another of the fundamental princples:  Keep it simple.  Text is simple.&lt;/p&gt;

&lt;h1 id=&quot;silence-is-golden&quot;&gt;Silence is Golden&lt;/h1&gt;

&lt;p&gt;With Bash, if everything went okay, the terminal will not say anything extra.  When a Bash
program has nothing surprising to report, it stays mum.  If you type
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;echo 'Hello World'&lt;/code&gt; and execute it, there’s no notice that your command succeeded.
There’s only the output your program created.&lt;/p&gt;

&lt;p&gt;Beyond that, you can see if you got a non-zero or a zero exit status: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;echo $?&lt;/code&gt;.
Basically, if there’s a problem, Linux/Unix will probably tell you.  It just assumes
you know what you’re doing.  It will only throw some kind of error if you made a
syntax error or something.  Otherwise, Bash will simply try to give you exactly what
you asked for.  And this is consistent with Linux/Unix design.&lt;/p&gt;

&lt;h1 id=&quot;keep-it-simple&quot;&gt;Keep it Simple&lt;/h1&gt;

&lt;p&gt;Cleaverness kills in programming.  Just be clear.  Not only will you be following
Unix philosophy, but people will be able to read your Bash scripts.  Also, whenever
you’re ready to put a script into production, ask yourself if you could understand
what you’re doing even if you have a really bad hangover.&lt;/p&gt;

&lt;p&gt;It’s easy to indulge our egos when we’re feeling cleaver and show off how smart we
were that day in our script.  But that “successful” feeling can turn into annoyance
as soon as you stop feeling very cleaver.  Write the script so you can follow your
own work on your dumb days too, not just your cleaver days.&lt;/p&gt;</content><author><name></name></author><category term="linux," /><category term="bash" /><summary type="html">How Learning Bash Helps you Learn Linux</summary></entry><entry><title type="html">Whiptail Progress Gauges</title><link href="/bash/2021/04/30/Whiptail_Progress_Gauges.html" rel="alternate" type="text/html" title="Whiptail Progress Gauges" /><published>2021-04-30T15:16:27+00:00</published><updated>2021-04-30T15:16:27+00:00</updated><id>/bash/2021/04/30/Whiptail_Progress_Gauges</id><content type="html" xml:base="/bash/2021/04/30/Whiptail_Progress_Gauges.html">&lt;h2 id=&quot;creating-progress-gauges-with-whiptail&quot;&gt;Creating Progress Gauges with Whiptail&lt;/h2&gt;

&lt;p&gt;Whiptail is a dandy TUI (terminal user interface) toolkit that helps you make bash scripts
for non-technical users.  Or for people who just don’t like terminals.  The terminal is
a huge source of information.  Sometimes it’s too much information.  When it is, a toolkit
like Whiptail can make your scripts seem more friendly.  In particular, though, progress 
gauges can seem a little problematic, because you must provide the indication of progress
yourself.  The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--gauge&lt;/code&gt; switch doesn’t possess any magical qualities that help it to know
how much more a process must operate before it completes.  In fact, it has absolutely no way 
to know the progress of a process toward completion.  You must program that progress 
yourself.  I’m going to talk about that in this article.&lt;/p&gt;

&lt;h2 id=&quot;the-basic-syntax&quot;&gt;The Basic Syntax&lt;/h2&gt;

&lt;p&gt;It’s worth reading the man page for all the switches for Whiptail.  But the switches you’ll use
a lot are &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--title&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--infobox&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--msgbox&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--yesno&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--radiolist&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--inputbox&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--textbox&lt;/code&gt;,
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--passwordbox&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--menu&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--checklist&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--gauge&lt;/code&gt;.  Followed by the dimensions of the
box itself in lines and columns.  Example:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;name=$(whiptail --title &quot;Sample input&quot; --inputbox &quot;What is your name?&quot; 8 60 3&amp;amp;&amp;gt;1 1&amp;gt;&amp;amp;2 2&amp;amp;&amp;gt;3)

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Some of the switches need to redirect STDIN and STDOUT, so we need to redirect it back so that
everything works. Here we capture user input into a variable that we can use later.  You’ll have 
to read up more on that redirection elsewhere, because I’m going to focus on the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--gauge&lt;/code&gt; switch.&lt;/p&gt;

&lt;h2 id=&quot;the-problem-with-progress-gauges&quot;&gt;The Problem with Progress Gauges&lt;/h2&gt;

&lt;p&gt;As I mentioned, you need to solve the problem of displaying a stream of numbers between 1 and 100
that meaningfully show the progress a UNIX process is making.  The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--gauge&lt;/code&gt; switch has no built-in
way of doing that.  That means that whatever process you’re measuring, you need to find a way of
providing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--gauge&lt;/code&gt; a way of knowing its progress.&lt;/p&gt;

&lt;p&gt;In most tutorials for whiptail I see something like the following:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;{
    for ((i=0; i&amp;lt;=100; i+=1)); do
        sleep 0.1
        echo $i
    done
} | whiptail --backtitle &quot;PROGRESS GAUGE&quot; --title &quot;Calculating Result&quot; --gauge &quot;Please wait for calculation&quot; 8 50 0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This will work.  It will display a progress bar while some process has been executed, but there will
probably be no correlation between the process’s progress and the gauge.  What are some other
possibilities?&lt;/p&gt;

&lt;p&gt;Let’s assume for now that our process is abstract enough that we cannot measure the physical size of a 
target file and a destination file.  That would be easy enough to show in a progress bar.  And if your
gauge just needs to measure a shrinking differential between two physical objects like that, then your
calculation is simple.  But what if all you have is a process that doesn’t easily lend itself to 
being measured?  Where all you have is a PID?&lt;/p&gt;

&lt;p&gt;First, we’ll have to launch the process in the background which means spawning a subshell.  Otherwise, we couldn’t
measure the process in the same script.  So, remember that!  We need to launch the process to the background and
capture its PID, then watch for the process to disappear from the PID table.  How on Earth do we make that happen?&lt;/p&gt;

&lt;p&gt;Well, I would recommend passing the name of the function to execute in the background as a parameter to
the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;processgauge&lt;/code&gt; function.  We need three workers here.  So that would mean something like this:&lt;/p&gt;

&lt;h2 id=&quot;the-calculator-the-caller-and-the-gauge&quot;&gt;The Calculator, The Caller and the Gauge&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;calculate(){                                                    ## The Calculator! 'How many angels on a pidhead?'
    echo `Highly technical, time-consuming process here...`
    sleep 600  # sleep for 10 minutes
}

showprogress(){                                        ## The Gauge:  Produce the number stream
    start=$1; end=$2; shortest=$3; longest=$4

    for n in $(seq $start $end); do
        echo $n
        pause=$(shuf -i ${shortest:=1}-${longest:=3} -n 1)  # random wait between 1 and 3 seconds
        sleep $pause
    done
}

processgauge(){                                         ## The Caller:  Start the gauge and watch the PID
    process_to_measure=$1
    message=$2
    backmessage=$3
    eval $process_to_measure &amp;amp;
    thepid=$!
    num=25
    while true; do
        showprogress 1 $num 1 3
        sleep 2
        while $(ps aux | grep -v 'grep' | grep &quot;$thepid&quot; &amp;amp;&amp;gt;/dev/null); do
            if [[ $num -gt 97 ]] ; then num=$(( num-1 )); fi
            showprogress $num $((num+1))
            num=$((num+1))
        done
        showprogress 99 100 3 3
    done  | whiptail --backtitle &quot;$backmessage&quot; --title &quot;Progress Gauge&quot; --gauge &quot;$message&quot; 6 70 0
}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This idea relies on capturing the PID of the process to measure.  Then producing numbers up until the process drops out
of the PID table.  We get a guaranteed number stream up to 25, but you can set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;num&lt;/code&gt; to whatever you want.  You can
also make the sleep period longer by offering larger numbers for the shortest and longest sleep values.  So one
advantage of this approach is that it is flexible.&lt;/p&gt;

&lt;p&gt;This type of approach works for short processes and long processes.  You can set longer sleep times in
process gauge (The Caller) for a longer process or shorter sleep times.  You can make consistent
sleep times if you like.  Unfortunately, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shuf&lt;/code&gt; will not accept decimal arguments.  They must be
integers, even though &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sleep&lt;/code&gt; will accept decimal arguments.  You could probably find another way
of managing that problem if you like.  For now, this works for me.  Perhaps in the future I’ll 
generate shorter sleep times than one second.&lt;/p&gt;

&lt;p&gt;So, from a menu to run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;calculate&lt;/code&gt;, you could call&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;processgauge calculate &quot;Calculating Maximum Beer Intake&quot; &quot;Calculating MAXBEERS...&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;You’ll have to experiment with different calculations to see how you like the progress bar with 
different scenarios.  On shorter processes, the progress bar may jump from 25 to 100 percent
really quickly.  On longer processes, the bar may go back and forth between 97 and 98 percent
for a long time.  I chose this vacilation back and forth because at least you know the process hasn’t
gotten hung up.  At least it’s still running.  You could put something else in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;calculate&lt;/code&gt; that
outputs to a logfile and then &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tail -f&lt;/code&gt; that logfile to show any errors encountered or other issues.
For example:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;calculate(){
    logfile=&quot;./logfile&quot;
    length=600
    [[ -f $logfile ]] &amp;amp;&amp;amp; rm $logfile
    echo &quot;=== START ===&quot; &amp;amp;&amp;gt;$logfile
    for ((i=0; i&amp;lt;=$length; i+=1)); do
        echo &quot;$i:&quot; &amp;amp;&amp;gt;&amp;gt;$logfile
        date +&quot;%D::%N&quot; &amp;amp;&amp;gt;&amp;gt;$logfile
    done
    echo &quot;=== END ===&quot; &amp;amp;&amp;gt;&amp;gt;$logfile
}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now for longer processes in the background you can watch a logfile to see how it’s doing.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;This is only one beginning.  I’m sure there are lots more approaches to creating a progress gauge with Whiptail. I like
the flexibility.  I like how easily I can adapt it.  But this approach got me going for today.  I’m back in business
with Whiptail!&lt;/p&gt;</content><author><name></name></author><category term="bash" /><summary type="html">Creating Progress Gauges with Whiptail</summary></entry><entry><title type="html">Arch Linux Install Script</title><link href="/linux/arch/2021/02/24/Arch_Linux_Install_Script.html" rel="alternate" type="text/html" title="Arch Linux Install Script" /><published>2021-02-24T02:58:29+00:00</published><updated>2021-02-24T02:58:29+00:00</updated><id>/linux/arch/2021/02/24/Arch_Linux_Install_Script</id><content type="html" xml:base="/linux/arch/2021/02/24/Arch_Linux_Install_Script.html">&lt;h1 id=&quot;arch-linux-install-script&quot;&gt;Arch Linux Install Script&lt;/h1&gt;

&lt;p&gt;Many new Linux users eventually gravitate toward a more minimal Linux distro where they
essentially get to build their own distro, according to their own preferences rather
than Canonical’s or another big distro sponsor.  Arch Linux is a terrific destination
for these intermediate Linux users, because there is a lot of freedom and choice.  You
get to build your own distro, since you install it by hand.  After you’ve installed Arch
by hand a few times, you’ll probably want to create your own Arch install script.&lt;/p&gt;

&lt;p&gt;Since you’ve already installed the distro by hand several times, you probably already have
a list of preferred applications and ways of installing Arch.  This script will reflect
the simplest possible steps that are automated yet easily comprehended by someone not
totally brand new to bash scripting.&lt;/p&gt;

&lt;p&gt;This script, named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;simplest.sh&lt;/code&gt;, is mainly a skeleton that you can modify and that can grow
with your growing scripting skills.  WARNING: I’m using an MBR disk label here.  This will
probably not work with a UEFI Motherboard or EFI bios.  For that you should really use a GPT
disk label with an EFI partition formatted with FAT-32.  My other install scripts use this
format, or they are capable of branching to install with GPT disk label and EFI-friendly
partitioning scheme according to whether a fully compliant EFI bios exists.  I’ll revisit
this later.&lt;/p&gt;

&lt;p&gt;When you boot up the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;archiso&lt;/code&gt; disk image from your thumbdrive or ISO file, you’ll need to
fetch this script.  From a terminal, you can get it by typing
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl -O https://raw.githubusercontent.com/deepbsd/farchi/master/simplest.sh&lt;/code&gt;
The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;simplest.sh&lt;/code&gt; file will appear in your root directory.  You should edit the variables to
conform to your preferences.  For example, if you have a 20G virtual drive (or hard drive)
and 2G of RAM, you’ll perhaps want 10G of root partition and 4G of swap partition.  You’ll
want your own hostname and so on.  You’ll need to edit the script before you run it,
obviously.  For testing on a VM I usually create a 30G virtual disk with 1G of RAM.&lt;/p&gt;

&lt;p&gt;You can grab the Farchi script like this:&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl -O https://raw.githubusercontent.com/deepbsd/farchi/master/farchi.sh&lt;/code&gt;
Obviously, my username on Github is deepbsd.  The name of the repo is farchi. And you’ll want
to snag the master branch of that repo.&lt;/p&gt;

&lt;p&gt;Here’s my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;simplest.sh&lt;/code&gt; script, which should just give you a starting place for your own
script.  This script does not install X.  You can have that as a future exercise!  Or you can
use my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;install_x.sh&lt;/code&gt; script at the same location if you need ideas.  But if you just want 
to install a basic, vanilla Arch system, this script takes about 5-7 minutes on my 
i5-4690k with 32G of RAM and an NVME SSD, depending on network speed, mostly.  Because of
the number of dependencies for X, installing X takes about twice that long.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; 1	#!/usr/bin/env bash
   
 2	##  This is the simplest possible Arch Linux install script I think...
 3	HOSTNAME=&quot;marbie1&quot;
 4	#VIDEO_DRIVER=&quot;xf86-video-vmware&quot;
 5	IN_DEVICE=/dev/sda
 6	BOOT_DEVICE=&quot;${IN_DEVICE}1&quot;
 7	ROOT_DEVICE=&quot;${IN_DEVICE}2&quot;
 8	SWAP_DEVICE=&quot;${IN_DEVICE}3&quot;
 9	HOME_DEVICE=&quot;${IN_DEVICE}4&quot;
   
10	BOOT_SIZE=512M
11	SWAP_SIZE=2G
12	ROOT_SIZE=13G
13	HOME_SIZE=    # Take whatever is left over after other partitions
14	TIME_ZONE=&quot;America/New_York&quot;
15	LOCALE=&quot;en_US.UTF-8&quot;
16	#KEYBOARD=&quot;us&quot;    # change if you need to
17	FILESYSTEM=ext4
   
18	use_bcm4360(){ return 1; }  # return 0 for &quot;truthy&quot; and 1 for &quot;falsy&quot;
   
19	if $(use_bcm4360) ; then
20	    WIRELESSDRIVERS=&quot;broadcom-wl-dkms&quot;
21	else
22	    WIRELESSDRIVERS=&quot;&quot;
23	fi
   
24	BASE_SYSTEM=( base base-devel linux linux-headers linux-firmware dkms vim iwd )
   
25	devel_stuff=( git nodejs npm npm-check-updates ruby )
26	printing_stuff=( system-config-printer foomatic-db foomatic-db-engine gutenprint cups cups-pdf cups-filters cups-pk-helper ghostscript gsfonts )
27	multimedia_stuff=( brasero sox eog shotwell imagemagick sox cmus mpg123 alsa-utils cheese )
   
28	# VERIFY BOOT MODE
29	efi_boot_mode(){
30	    [[ -d /sys/firmware/efi/efivars ]] &amp;amp;&amp;amp; return 0
31	    return 1
32	}
   
33	# All purpose error
34	error(){ echo &quot;Error: $1&quot; &amp;amp;&amp;amp; exit 1; }
   
35	###############################
36	###  START SCRIPT HERE
37	###############################
   
38	### Check that reflector is done
39	clear
40	echo &quot;Waiting until reflector has finished updating mirrorlist...&quot;
41	while true; do
42	    pgrep -x reflector &amp;amp;&amp;gt;/dev/null || break
43	    echo -n '.'
44	    sleep 2
45	done
   
46	### Test internet connection
47	clear
48	echo &quot;Testing internet connection...&quot;
49	$(ping -c 3 archlinux.org &amp;amp;&amp;gt;/dev/null) || (error &quot;Not Connected to Network!!!&quot;)
50	echo &quot;Good!  We're connected!!!&quot; &amp;amp;&amp;amp; sleep 3
   
51	## Check time and date before installation
52	timedatectl set-ntp true
53	echo &amp;amp;&amp;amp; echo &quot;Date/Time service Status is . . . &quot;
54	timedatectl status
55	sleep 4
   
56	$(efi_boot_mode) &amp;amp;&amp;amp; error &quot;You have a UEFI Bios; Please use the Farchi or Darchi script for installation&quot;
   
57	####  Could just use cfdisk to partition drive
58	#cfdisk &quot;$IN_DEVICE&quot;    # for non-EFI VM: /boot 512M; / 13G; Swap 2G; Home Remainder
   
59	###  NOTE: Drive partitioning is one of those highly customizable areas where your
60	###        personal preferences and needs will dictate your choices.  Many options
61	###        exist here.  An MBR disklabel is very old, limited, and may well inspire
62	###        you to investigate other options, which is a good exercise.  But, MBR is pretty
63	###        simple and reliable, within its constraints.  Bon voyage!
   
   
   
64	# Using sfdisk because we're talking MBR disktable now...
65	cat &amp;gt; /tmp/sfdisk.cmd &amp;lt;&amp;lt; EOF
66	$BOOT_DEVICE : start= 2048, size=+$BOOT_SIZE, type=83, bootable
67	$ROOT_DEVICE : size=+$ROOT_SIZE, type=83
68	$SWAP_DEVICE : size=+$SWAP_SIZE, type=82
69	$HOME_DEVICE : type=83
70	EOF
   
71	sfdisk &quot;$IN_DEVICE&quot; &amp;lt; /tmp/sfdisk.cmd 
   
72	#####  Format filesystems
73	mkfs.ext4 &quot;$BOOT_DEVICE&quot;    # /boot
74	mkfs.ext4 &quot;$ROOT_DEVICE&quot;    # /
75	mkswap &quot;$SWAP_DEVICE&quot;       # swap partition
76	mkfs.ext4 &quot;$HOME_DEVICE&quot;    # /home
   
77	#### Mount filesystems
78	mount &quot;$ROOT_DEVICE&quot; /mnt
79	mkdir /mnt/boot &amp;amp;&amp;amp; mount &quot;$BOOT_DEVICE&quot; /mnt/boot
80	swapon &quot;$SWAP_DEVICE&quot;
81	mkdir /mnt/home &amp;amp;&amp;amp; mount &quot;$HOME_DEVICE&quot; /mnt/home
   
82	lsblk &amp;amp;&amp;amp; echo &quot;Here're your new block devices. (Type any key to continue...)&quot; ; read empty
   
   
83	###  Install base system
84	clear
85	echo &amp;amp;&amp;amp; echo &quot;Press any key to continue to install BASE SYSTEM...&quot;; read empty
86	pacstrap /mnt &quot;${BASE_SYSTEM[@]}&quot;
87	echo &amp;amp;&amp;amp; echo &quot;Base system installed.  Press any key to continue...&quot;; read empty
   
88	# GENERATE FSTAB
89	echo &quot;Generating fstab...&quot;
90	genfstab -U /mnt &amp;gt;&amp;gt; /mnt/etc/fstab
91	cat /mnt/etc/fstab
92	echo &amp;amp;&amp;amp; echo &quot;Here's your fstab. Type any key to continue...&quot;; read empty
   
93	## SET UP TIMEZONE AND LOCALE
94	clear
95	echo &amp;amp;&amp;amp; echo &quot;setting timezone to $TIME_ZONE...&quot;
96	arch-chroot /mnt ln -sf /usr/share/zoneinfo/&quot;$TIME_ZONE&quot; /etc/localtime
97	arch-chroot /mnt hwclock --systohc --utc
98	arch-chroot /mnt date
99	echo &amp;amp;&amp;amp; echo &quot;Here's the date info, hit any key to continue...&quot;; read empty
   
100	## SET UP LOCALE
101	clear
102	echo &amp;amp;&amp;amp; echo &quot;setting locale to $LOCALE ...&quot;
103	arch-chroot /mnt sed -i &quot;s/#$LOCALE/$LOCALE/g&quot; /etc/locale.gen
104	arch-chroot /mnt locale-gen
105	echo &quot;LANG=$LOCALE&quot; &amp;gt; /mnt/etc/locale.conf
106	export LANG=&quot;$LOCALE&quot;
107	cat /mnt/etc/locale.conf
108	echo &amp;amp;&amp;amp; echo &quot;Here's your /mnt/etc/locale.conf. Type any key to continue.&quot;; read empty
   
109	## HOSTNAME
110	clear
111	echo &amp;amp;&amp;amp; echo &quot;Setting hostname...&quot;; sleep 3
112	echo &quot;$HOSTNAME&quot; &amp;gt; /mnt/etc/hostname
   
113	cat &amp;gt; /mnt/etc/hosts &amp;lt;&amp;lt;HOSTS
114	127.0.0.1      localhost
115	::1            localhost
116	127.0.1.1      $HOSTNAME.localdomain     $HOSTNAME
117	HOSTS
   
118	echo &amp;amp;&amp;amp; echo &quot;/etc/hostname and /etc/hosts files configured...&quot;
119	echo &quot;/etc/hostname . . . &quot;
120	cat /mnt/etc/hostname 
121	echo &quot;/etc/hosts . . .&quot;
122	cat /mnt/etc/hosts
123	echo &amp;amp;&amp;amp; echo &quot;Here are /etc/hostname and /etc/hosts. Type any key to continue &quot;; read empty
   
124	## SET ROOT PASSWD
125	clear
126	echo &quot;Setting ROOT password...&quot;
127	arch-chroot /mnt passwd
   
128	## INSTALLING MORE ESSENTIALS
129	clear
130	echo &amp;amp;&amp;amp; echo &quot;Enabling dhcpcd, pambase, sshd and NetworkManager services...&quot; &amp;amp;&amp;amp; echo
131	arch-chroot /mnt pacman -S git openssh networkmanager dhcpcd man-db man-pages pambase
132	arch-chroot /mnt systemctl enable dhcpcd.service
133	arch-chroot /mnt systemctl enable sshd.service
134	arch-chroot /mnt systemctl enable NetworkManager.service
135	arch-chroot /mnt systemctl enable systemd-homed
136	echo &amp;amp;&amp;amp; echo &quot;Press any key to continue...&quot;; read empty
   
137	## ADD USER ACCT
138	clear
139	echo &amp;amp;&amp;amp; echo &quot;Adding sudo + user acct...&quot;
140	sleep 2
141	arch-chroot /mnt pacman -S sudo bash-completion sshpass
142	arch-chroot /mnt sed -i 's/# %wheel/%wheel/g' /etc/sudoers
143	arch-chroot /mnt sed -i 's/%wheel ALL=(ALL) NOPASSWD: ALL/# %wheel ALL=(ALL) NOPASSWD: ALL/g' /etc/sudoers
144	echo &amp;amp;&amp;amp; echo &quot;Please provide a username: &quot;; read sudo_user
145	echo &amp;amp;&amp;amp; echo &quot;Creating $sudo_user and adding $sudo_user to sudoers...&quot;
146	arch-chroot /mnt useradd -m -G wheel &quot;$sudo_user&quot;
147	echo &amp;amp;&amp;amp; echo &quot;Password for $sudo_user?&quot;
148	arch-chroot /mnt passwd &quot;$sudo_user&quot;
   
149	## INSTALL WIFI
150	$(use_bcm4360) &amp;amp;&amp;amp; arch-chroot /mnt pacman -S &quot;$WIRELESSDRIVERS&quot;
151	[[ &quot;$?&quot; -eq 0 ]] &amp;amp;&amp;amp; echo &quot;Wifi Driver successfully installed!&quot;; sleep 5
   
152	## Not installing X in this script...
   
153	## INSTALL GRUB
154	clear
155	echo &quot;Installing grub...&quot; &amp;amp;&amp;amp; sleep 4
156	arch-chroot /mnt pacman -S grub os-prober
   
157	## We're not checking for EFI; We're assuming MBR
158	arch-chroot /mnt grub-install &quot;$IN_DEVICE&quot;
   
159	echo &quot;configuring /boot/grub/grub.cfg...&quot;
160	arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg
161	[[ &quot;$?&quot; -eq 0 ]] &amp;amp;&amp;amp; echo &quot;mbr bootloader installed...&quot;
   
162	echo &quot;Your system is installed.  Type shutdown -h now to shutdown system and remove bootable media, then restart&quot;
163	read empty

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;notes-about-simplestsh&quot;&gt;Notes About Simplest.sh&lt;/h2&gt;

&lt;p&gt;As I mentioned, I’m using an MBR disk label.  You’ll want to change this if you’re installing
to a newer motherboard or BIOS.&lt;/p&gt;

&lt;p&gt;The first thing to do is set up my variable names as preferences.  Things like partition
names and sizes, hostname, wifi driver, video chipset driver, swap space size, root partition
size (I assume a 30G VM disk to start with), timezone, keyboard layout (US is assumed), and 
locale and filesystem format (I assume ext4).&lt;/p&gt;

&lt;p&gt;I normally include a few extra packages with dependencies, like printing and networking
utilities, a few multimedia things and some development goodies.  I could easily include X
and an appropriate display manager and desktop environment or window manager.  I happen to
like Cinnamon, but I normally install XFCE and i3wm as well, just to have options (sometimes
I like to switch things up!).  For this script, I opted out of installing X, but you can
check out my Farchi script or my Darchi script.  You can see how I branch conditionally from
preferences.  I figure you’ll want to just see if the script works for you.&lt;/p&gt;

&lt;p&gt;If you want to modify the script to create create GPT partitions, you could use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sgdisk&lt;/code&gt;.&lt;br /&gt;
That’s what I use in the Farchi and Darchi scripts.  You could create all the partitions with
simply using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cfdisk&lt;/code&gt;, but I think it’s a good exercise to automate it.  Plus, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sfdisk&lt;/code&gt; and
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sgdisk&lt;/code&gt; are really fast.  You can create partitions and volume groups in 3 seconds or less!
It’s wicked fast!&lt;/p&gt;

&lt;p&gt;You could use a phrase something like this to create partitions using sgdisk:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; 1   if $(efi_boot_mode); then
 2	     sgdisk -Z &quot;$IN_DEVICE&quot;
 3	     sgdisk -n 1::+&quot;$EFI_SIZE&quot; -t 1:ef00 -c 1:EFI &quot;$IN_DEVICE&quot;
 4	     sgdisk -n 2::+&quot;$ROOT_SIZE&quot; -t 2:8300 -c 2:ROOT &quot;$IN_DEVICE&quot;
 5	     sgdisk -n 3::+&quot;$SWAP_SIZE&quot; -t 3:8200 -c 3:SWAP &quot;$IN_DEVICE&quot;
 6	     sgdisk -n 4 -c 4:HOME &quot;$IN_DEVICE&quot;
 7   fi
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Of course, these variables would have to be defined, and so on.  You’d have to define the
efi_boot_mode function something like I did in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;simplest.sh&lt;/code&gt; script.  And you’d have to
complete the rest of the conditional accordingly.&lt;/p&gt;

&lt;p&gt;Further, you’d need to install the EFI boot manager instead of a normal non-efi boot loader.
I typically use GRUB with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;efi-bootmanager&lt;/code&gt; package and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--target&lt;/code&gt; and
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--efi-directory&lt;/code&gt; flags.  Works fine for me so far.&lt;/p&gt;

&lt;p&gt;When you’re installing packages and their dependencies, you’ll want to pause at certain
times to see if any packages installed with a non-zero exit status.  You’ll want to take note
of any errors and determine whether they are significant. Normally they are not.  For
example, sometimes a package gets installed twice, but this is not a problem.  Pacman is
happy to reinstall packages usually.  But I’ve included some &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;read&lt;/code&gt; statements to allow
seeing the final notes of a process before the screen clears and any errors or information
scrolls past, away from your notice.&lt;/p&gt;

&lt;p&gt;I like to use ‘here’ documents.  You’ll see me using arrays and associative arrays in bash.
Also I use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;amp;&amp;amp;&lt;/code&gt; instead of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;if/then&lt;/code&gt; where it saves time and doesn’t obscure readability.  I
like to pipe unneccesary output to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/null&lt;/code&gt; when I’m checking exit statuses for functions.
Finally, I’m still experimenting with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;systemd-homed&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pambase&lt;/code&gt;.  I’ve had some problems
when installing X: I have trouble using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo&lt;/code&gt; from an X terminal.  Not sure why that is, but
reinstalling &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pambase&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;systemd-homed&lt;/code&gt; solved the problem.  I’m still not sure how this
problem got started in the first place, but I assumed there was a package change by the
maintainers. More study for me in the future! You should probably experiement with this
situation and see what works best for you.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Hopefully this will get you started with installing Arch linux automatically.  When I first
started, I simply used &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cfdisk /dev/sda&lt;/code&gt; to create my partitions.  This script was much
rougher and more ragged.  But it evolved.  The Farchi and Darchi scripts are more evolved.
You can see that in just more than 150 lines of Bash, an entire system get installed. If you
wanted to install X, that’s probably another 50-75 lines.  So you can see it doesn’t take a
whole lot of scripting to get your basic Arch system up and running!  I’m hoping you’ll be
able to borrow this script to get started on your own journey.  Bon voyage!&lt;/p&gt;</content><author><name></name></author><category term="Linux" /><category term="Arch" /><summary type="html">Arch Linux Install Script</summary></entry><entry><title type="html">Remove Underline From Vim hi CursorLineNr</title><link href="/vim/2020/11/21/Remove_Underline_From_Vim_hi_CursorLineNr.html" rel="alternate" type="text/html" title="Remove Underline From Vim hi CursorLineNr" /><published>2020-11-21T21:18:37+00:00</published><updated>2020-11-21T21:18:37+00:00</updated><id>/vim/2020/11/21/Remove_Underline_From_Vim_hi_CursorLineNr</id><content type="html" xml:base="/vim/2020/11/21/Remove_Underline_From_Vim_hi_CursorLineNr.html">&lt;h1 id=&quot;removing-underline-from-vim-hilighted-cursorlinenr&quot;&gt;Removing Underline from Vim Hilighted CursorLineNr&lt;/h1&gt;

&lt;p&gt;If you’re like me, you work hard to get your editor to look and act just as you like it.&lt;br /&gt;
When something changes without your permission, and now your editor has started looking like
it’s gone rogue, that’s bad.  I’m not sure what drove this change, but some time ago my 
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hi CursorLineNr&lt;/code&gt; value in my color theme started displaying an underline in my editor.
It kinda drove me nuts.  Even now, when I log into a new system where my syntax coloring files
have not been updated, I have to make the change to de-gunk my line number on the cursor line.
Here’r are some notes.&lt;/p&gt;

&lt;h2 id=&quot;what-files-to-change&quot;&gt;What files to change&lt;/h2&gt;

&lt;p&gt;In your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt;, you normally refer to a syntax color file.  Mine is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xoria256.vim&lt;/code&gt;.  It’s 
located in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$HOME/.vim/colors/xoria256.vim&lt;/code&gt;.  (Your installation may vary.)  In your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt; 
there should be a line that goes something like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;colorscheme xoria256&lt;/code&gt; or whatever the name
of your color theme is.  But what really needs modifying is the colorscheme file itself.&lt;/p&gt;

&lt;p&gt;Here is what mine looks like:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; 1	&quot; Vim color file
 2	&quot;
 3	&quot; Name:       xoria256.vim
 4	&quot; Version:    1.6
 5	&quot; Maintainer:	Dmitriy Y. Zotikov (xio) &amp;lt;xio@ungrund.org&amp;gt;
 6	&quot;
 7	&quot; Should work in recent 256 color terminals.  88-color terms like urxvt are
 8	&quot; NOT supported.
 9	&quot;
10	&quot; Don't forget to install 'ncurses-term' and set TERM to xterm-256color or
11	&quot; similar value.
12	&quot;
13	&quot; Color numbers (0-255) see:
14	&quot; http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
15	&quot;
16	&quot; For a specific filetype highlighting rules issue :syntax list when a file of
17	&quot; that type is opened.
18	&quot;
19	&quot; TODO: link colours instead of setting values explicitly
20	
21	&quot; Initialization {{{
22	if &amp;amp;t_Co != 256 &amp;amp;&amp;amp; ! has(&quot;gui_running&quot;)
23	  echoerr &quot;Please use GUI or a 256-color terminal (which sets t_Co=256).&quot;
24	  finish
25	endif
26	
27	set background=dark
28	
29	hi clear
30	
31	if exists(&quot;syntax_on&quot;)
32	  syntax reset
33	endif
34	
35	let colors_name = &quot;xoria256&quot;
36	&quot;}}}
37	&quot; Colours {{{1
38	&quot;&quot; General {{{2
39	hi Normal       ctermfg=252 guifg=#d0d0d0 ctermbg=234 guibg=#1c1c1c cterm=none gui=none
40	hi Cursor                                 ctermbg=214 guibg=#ffaf00
41	hi CursorColumn                           ctermbg=238 guibg=#444444
42	&quot;hi CursorLine                             ctermbg=237 guibg=#3a3a3a cterm=none gui=none 
43	hi CursorLine                             ctermbg=237 ctermfg=grey guibg=#3a3a3a cterm=none gui=none 
44	hi CursorLineNr                             ctermfg=white ctermbg=magenta guibg=#3a3a3a cterm=none gui=none 
45	hi Error        ctermfg=15  guifg=#ffffff ctermbg=1   guibg=#800000
46	hi ErrorMsg     ctermfg=15  guifg=#ffffff ctermbg=1   guibg=#800000
47	hi FoldColumn   ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
48	hi Folded       ctermfg=255 guifg=#eeeeee ctermbg=60  guibg=#5f5f87
49	hi IncSearch    ctermfg=0   guifg=#000000 ctermbg=223 guibg=#ffdfaf cterm=none gui=none
50	hi LineNr       ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
51	hi MatchParen   ctermfg=188 guifg=#dfdfdf ctermbg=68  guibg=#5f87df cterm=bold gui=bold
52	&quot; TODO
53	&quot; hi MoreMsg
54	hi NonText      ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212 cterm=bold gui=bold
55	hi Pmenu        ctermfg=0   guifg=#000000 ctermbg=250 guibg=#bcbcbc
56	hi PmenuSel     ctermfg=255 guifg=#eeeeee ctermbg=243 guibg=#767676
57	hi PmenuSbar                              ctermbg=252 guibg=#d0d0d0
58	hi PmenuThumb   ctermfg=243 guifg=#767676
59	hi Search       ctermfg=0   guifg=#000000 ctermbg=149 guibg=#afdf5f
60	hi SignColumn   ctermfg=248 guifg=#a8a8a8
61	hi SpecialKey   ctermfg=77  guifg=#5fdf5f
62	&quot; hi SpellBad     ctermfg=160 guifg=fg      ctermbg=bg                cterm=underline               guisp=#df0000
63	hi SpellBad                               ctermbg=238                                               guisp=#df0000
64	hi SpellCap     ctermfg=189 guifg=#dfdfff ctermbg=bg  guibg=bg      cterm=underline gui=underline
65	hi SpellRare    ctermfg=168 guifg=#df5f87 ctermbg=bg  guibg=bg      cterm=underline gui=underline
66	hi SpellLocal   ctermfg=98  guifg=#875fdf ctermbg=bg  guibg=bg      cterm=underline gui=underline
67	hi StatusLine   ctermfg=15  guifg=#ffffff ctermbg=239 guibg=#4e4e4e cterm=bold gui=bold
68	hi StatusLineNC ctermfg=249 guifg=#b2b2b2 ctermbg=237 guibg=#3a3a3a cterm=none gui=none
69	hi TabLine      ctermfg=fg  guifg=fg      ctermbg=242 guibg=#666666 cterm=none gui=none
70	hi TabLineFill  ctermfg=fg  guifg=fg      ctermbg=237 guibg=#3a3a3a cterm=none gui=none
71	&quot; FIXME
72	hi Title        ctermfg=225 guifg=#ffdfff
73	hi Todo         ctermfg=0   guifg=#000000 ctermbg=184 guibg=#dfdf00
74	hi Underlined   ctermfg=39  guifg=#00afff                           cterm=underline gui=underline
75	hi VertSplit    ctermfg=237 guifg=#3a3a3a ctermbg=237 guibg=#3a3a3a cterm=none gui=none
76	&quot; hi VIsualNOS    ctermfg=24  guifg=#005f87 ctermbg=153 guibg=#afdfff cterm=none gui=none
77	&quot; hi Visual       ctermfg=24  guifg=#005f87 ctermbg=153 guibg=#afdfff
78	hi Visual       ctermfg=255 guifg=#eeeeee ctermbg=96  guibg=#875f87
79	&quot; hi Visual       ctermfg=255 guifg=#eeeeee ctermbg=24  guibg=#005f87
80	hi VisualNOS    ctermfg=255 guifg=#eeeeee ctermbg=60  guibg=#5f5f87
81	hi WildMenu     ctermfg=0   guifg=#000000 ctermbg=150 guibg=#afdf87 cterm=bold gui=bold
82	
83	&quot;&quot; Syntax highlighting {{{2
84	hi Comment      ctermfg=244 guifg=#808080
85	hi Constant     ctermfg=229 guifg=#ffffaf
86	hi Identifier   ctermfg=182 guifg=#dfafdf                           cterm=none
87	hi Ignore       ctermfg=238 guifg=#444444
88	hi Number       ctermfg=180 guifg=#dfaf87
89	hi PreProc      ctermfg=150 guifg=#afdf87
90	hi Special      ctermfg=174 guifg=#df8787
91	hi Statement    ctermfg=110 guifg=#87afdf                           cterm=none gui=none
92	hi Type         ctermfg=146 guifg=#afafdf                           cterm=none gui=none
93	
94	&quot;&quot; Special {{{2
95	&quot;&quot;&quot; .diff {{{3
96	hi diffAdded    ctermfg=150 guifg=#afdf87
97	hi diffRemoved  ctermfg=174 guifg=#df8787
98	&quot;&quot;&quot; vimdiff {{{3
99	hi diffAdd      ctermfg=bg  guifg=bg      ctermbg=151 guibg=#afdfaf    100	&quot;hi diffDelete   ctermfg=bg  guifg=bg      ctermbg=186 guibg=#dfdf87 cterm=none gui=none    101	hi diffDelete   ctermfg=bg  guifg=bg      ctermbg=246 guibg=#949494 cterm=none gui=none    102	hi diffChange   ctermfg=bg  guifg=bg      ctermbg=181 guibg=#dfafaf    103	hi diffText     ctermfg=bg  guifg=bg      ctermbg=174 guibg=#df8787 cterm=none gui=none    104	&quot;&quot;&quot; HTML {{{3    105	&quot; hi htmlTag      ctermfg=146  guifg=#afafdf    106	&quot; hi htmlEndTag   ctermfg=146  guifg=#afafdf    107	hi htmlTag      ctermfg=244    108	hi htmlEndTag   ctermfg=244    109	hi htmlArg	ctermfg=182  guifg=#dfafdf    110	hi htmlValue	ctermfg=187  guifg=#dfdfaf    111	hi htmlTitle	ctermfg=254  ctermbg=95    112	&quot; hi htmlArg	ctermfg=146    113	&quot; hi htmlTagName	ctermfg=146    114	&quot; hi htmlString	ctermfg=187    115	&quot;&quot;&quot; XML {{{3    116	hi link xmlTagName	Statement    117	&quot; hi link xmlTag		Comment    118	&quot; hi link xmlEndTag	Statement    119	hi link xmlTag		xmlTagName    120	hi link xmlEndTag	xmlTag    121	hi link xmlAttrib	Identifier    122	&quot;&quot;&quot; django {{{3    123	hi djangoVarBlock ctermfg=180  guifg=#dfaf87    124	hi djangoTagBlock ctermfg=150  guifg=#afdf87    125	hi djangoStatement ctermfg=146  guifg=#afafdf    126	hi djangoFilter ctermfg=174  guifg=#df8787    127	&quot;&quot;&quot; python {{{3    128	hi pythonExceptions ctermfg=174    129	&quot;&quot;&quot; NERDTree {{{3    130	hi Directory      ctermfg=110  guifg=#87afdf    131	hi treeCWD        ctermfg=180  guifg=#dfaf87    132	hi treeClosable   ctermfg=174  guifg=#df8787    133	hi treeOpenable   ctermfg=150  guifg=#afdf87    134	hi treePart       ctermfg=244  guifg=#808080    135	hi treeDirSlash   ctermfg=244  guifg=#808080    136	hi treeLink       ctermfg=182  guifg=#dfafdf    137	&quot;&quot;&quot; rst #{{{3    138	hi link rstEmphasis Number    139	    140	&quot;&quot;&quot; VimDebug {{{3    141	&quot; FIXME    142	&quot; you may want to set SignColumn highlight in your .vimrc    143	&quot; :help sign    144	&quot; :help SignColumn    145	    146	&quot; hi currentLine term=reverse cterm=reverse gui=reverse    147	&quot; hi breakPoint  term=NONE    cterm=NONE    gui=NONE    148	&quot; hi empty       term=NONE    cterm=NONE    gui=NONE    149	    150	&quot; sign define currentLine linehl=currentLine    151	&quot; sign define breakPoint  linehl=breakPoint  text=&amp;gt;&amp;gt;    152	&quot; sign define both        linehl=currentLine text=&amp;gt;&amp;gt;    153	&quot; sign define empty       linehl=empty    154	&quot;&quot;&quot; vimHelp {{{3    155	hi link helpExample Number    156	hi link helpNumber String    157	hi helpURL ctermfg=110 guifg=#87afdf                           cterm=underline gui=underline    158	hi link helpHyperTextEntry helpURL
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You can see on lines 42-44 above, I have replaced the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hi CursorLineNr&lt;/code&gt; command.  In Vim script double quotes 
are comments.  So I commented out the old command and copied the same command with a new argument.  When
you try to go back in time and see what you changed, this might help you.  In the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CursorLine&lt;/code&gt; value I set 
the foreground color to grey.  This shows up nicely against the dark grey of xoria256 without being distracting.
To remove the underline from the line number, I need to define a background and foreground color for the 
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CursorLineNr&lt;/code&gt; value.  I chose a background of magenta with a foreground of white.  It looks pretty good.&lt;br /&gt;
The important thing is that it doesn’t distract me, either with too much color or too little, and I can find
my cusor on a large display without going hunting.&lt;/p&gt;

&lt;p&gt;Note that the color choices must be from the normal 8-bit color choices you have available in your terminal.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Find your color theme file from your callout in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt;.  Edit that file (the color file) to define your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hi CursorLine&lt;/code&gt; 
and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hi CursorLineNr&lt;/code&gt; values.  Define your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cterm&lt;/code&gt; values for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CursorLine&lt;/code&gt; and your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctermfg&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctermbg&lt;/code&gt; 
values for your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hi CursorLineNr&lt;/code&gt; lines.  Then close and reopen vim.  That should do it!  Voila!  Annoying
underline is now removed and replaced with a nice color combo of your chosing.&lt;/p&gt;</content><author><name></name></author><category term="vim" /><summary type="html">Removing Underline from Vim Hilighted CursorLineNr</summary></entry><entry><title type="html">Bash Pomodoro</title><link href="/bash/timekeeping/2020/02/24/Bash_Pomodoro.html" rel="alternate" type="text/html" title="Bash Pomodoro" /><published>2020-02-24T04:08:53+00:00</published><updated>2020-02-24T04:08:53+00:00</updated><id>/bash/timekeeping/2020/02/24/Bash_Pomodoro</id><content type="html" xml:base="/bash/timekeeping/2020/02/24/Bash_Pomodoro.html">&lt;h1 id=&quot;creating-a-pomodoro-in-bash&quot;&gt;Creating a Pomodoro in Bash&lt;/h1&gt;

&lt;p&gt;I originally wanted to create a pomodoro timer that could run in i3status or i3blocks.
I haven’t quite made it that far, but it does run in bash.  For those of you who
haven’t heard about it, see the Wikipedia article on the &lt;a href=&quot;https://en.wikipedia.org/Pomodoro_Technique&quot;&gt;Pomodoro
Technique&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I chose to create a work period of 25 minutes, with 5 minute short breaks and 20
minute long breaks.  I decided to measure the time using a date object measured in
seconds.  Then I figured I needed three functions: 1) a compute function that takes an
argument of seconds to start from and prints the number of seconds elapsed from that
date object (measured in seconds), 2) a “convert seconds” function that takes a date
object in seconds and returns the formated string of minutes and seconds that can 
be displayed to the user, and 3) a “seconds remaining” function that takes two
arguments: the number of seconds when the period started and the “now” time in
seconds, and that returns a printed string of remaining minutes and seconds in the
period.&lt;/p&gt;

&lt;p&gt;Further, I needed a function to run the breaks between work periods.  This function
would start a period for a certain length, and that length would be this functions
only required parameter.&lt;/p&gt;

&lt;p&gt;Once all this was working, I would need some kind of audible bell or something to tell
the user when the Pomodoro period or break was done, and when to take a break or
return to work.  So that was another function.&lt;/p&gt;

&lt;p&gt;Because I not only wanted this to run in a shell terminal, I wrote a function that
would display the work periods (pomodoros) and break periods in a single line that
could be displayed on a status bar like i3status or i3blocks for my favorite tiling
window manager, &lt;a href=&quot;https://i3wm.org&quot;&gt;i3wm&lt;/a&gt;.  This required that I actually have two
functions for showing a pomodoro, one that displays inside a terminal and one that
runs inside a bar.  Well, the “bar” function works such that it displays a line of
text that could run inside a status bar, but I haven’t gotten it to actually work
inside either i3bar or i3blocks.  It displays inside a terminal on a single line just
fine.  And the other functions works fine inside a terminal window; it takes up about
5 lines of text, separated by line spaces in-between, for a total of ten line spaces.&lt;/p&gt;

&lt;p&gt;Here’s the script:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;     1	#!/usr/bin/env bash
     2	
     3	#################################
     4	#  Easy little pomodoro time mgmt
     5	#  program to help you not waste time.
     6	#  This runs in a terminal, so you can use it 
     7	#  with a tiling window manager if desired.
     8	#  Requires 'play' is installed (from sox)
     9	#################################
    10	
    11	##  Initial variables
    12	short_break=5
    13	long_break=20
    14	pomodoro=25
    15	## Forgot that all terminals are not UTF
    16	#goal=&quot;⌚⌚⌚⌚⌚⌚⌚⌚&quot;
    17	goal=&quot;********&quot;
    18	completed_pomodoros=&quot;&quot;
    19	start_sound=./sounds/Ship_Bell-Mike_Koenig-1911209136.wav
    20	end_sound=./sounds/foghorn-daniel_simon.wav
    21	((durationinmins=${pomodoro}*3600/60))
    22	
    23	## Run the i3bar version or regular version?
    24	[[ &quot;$@&quot; =~ 'b' ]] &amp;amp;&amp;amp; runinbar=true || unset runinbar
    25	
    26	##  Set the start time in seconds
    27	start_time=$(date +%s)
    28	
    29	## Play start or end sounds for periods
    30	play_sound(){
    31	    ## make sure 'play' is installed...
    32	    command -v play &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || { echo &amp;gt;&amp;amp;2 &quot;play (from sox app) is required but not installed. aborting...&quot;; exit 1; } 
    33	    file=${1}
    34	    play -q $file 2&amp;gt;/dev/null
    35	}
    36	
    37	## Play the start sound
    38	play_sound $start_sound
    39	
    40	## Computes seconds elapsed from after 1st argument
    41	## Expects argument in seconds
    42	compute(){
    43	   start_secs=${1}
    44	   now_time=$(date +%s)
    45	   elapsed=$( expr $now_time - $start_secs )
    46	   printf &quot;%d &quot; &quot;${elapsed}&quot;
    47	}
    48	
    49	## Converts seconds to hours, minutes, seconds
    50	## Just displays minutes and seconds
    51	convertsecs(){
    52	    ((h=${1}/3600))
    53	    ((m=(${1}%3600)/60))
    54	    ((s=${1}%60))
    55	    #printf &quot;%02d:%02d:%02d&quot; $h $m $s
    56	    printf &quot;%02d:%02d&quot; $m $s
    57	}
    58	
    59	## Computes minutes and seconds remaining from start time
    60	## and now time,  Expects now_seconds then start_time
    61	remainingsecs(){
    62	    ((m=${2}-1-${1}%3600/60))
    63	    ((s=(60-${1}%60)))
    64	    [ $m -eq -1 ] &amp;amp;&amp;amp; m=0
    65	    printf &quot;%02d:%02d&quot; $m $s
    66	}
    67	
    68	## For showing a list of asterisks and completed Pomodoros
    69	completed(){
    70	    echo '⌚' 
    71	}
    72	
    73	##  Runs a break, either a short one or long one
    74	##  Expects an argument in minutes
    75	run_break(){
    76	    play_sound $end_sound
    77	    start=$(date +%s)
    78	    now=$(date +%s)
    79	    length=${1}
    80	    elapsed_secs=$(expr $now - $start)
    81	    minutes=$((elapsed_secs/60))
    82	
    83	
    84	
    85	    while [ $minutes -le $length ]; do
    86	        now=$(date +%s)
    87	        pomo=$(compute $start)
    88	        minutes=$((elapsed_secs/60))
    89	
    90	        ## exit and start a new Pomodoro when break is spent
    91	        if (($minutes &amp;gt;= $length)) ; then 
    92	            return 0
    93	        fi
    94	
    95	        elapsed_secs=$(expr $now - $start)
    96	        remaining=$(remainingsecs $elapsed_secs $length)
    97	        elapsed=$(convertsecs $pomo)
    98	        if [ $length -ne $short_break ]; then
    99	            break_type=&quot;Long Break&quot;
   100	        else
   101	            break_type=&quot;Short Break&quot;
   102	        fi
   103	
   104	        clear
   105	## Hot pink may not work well on light terminal but it does on dark terminal
   106	cat &amp;lt;&amp;lt;EOBreak
   107	
   108	
   109	        $(echo -e &quot;\033[38;5;205m&quot;)
   110	        //////////////////////   BREAK TIME  //////////////////////////////
   111	
   112	        Break: ${break_type}    Elapsed: ${elapsed}   Remaining:  ${remaining}
   113	        $(echo -e &quot;\033[m&quot;)
   114	
   115	EOBreak
   116	
   117	        sleep 1
   118	    done
   119	}
   120	
   121	show_bar(){
   122	    count=0
   123	    period=${1}
   124	    length=${2}
   125	    start=$(date +%s)
   126	    spinner=('\' '|' '/' '—' '\' '|' '/' '—')
   127	
   128	
   129	    while true; do
   130	        elapsedsecs=$(compute $start)
   131	        [ ${elapsedsecs} -gt $((length*60)) ] &amp;amp;&amp;amp; return
   132	        pomo=$(compute $start)
   133	        elapsed=$(convertsecs $pomo)
   134	        remaining=$(remainingsecs $pomo $length)
   135	        clear
   136	        printf &quot;%s &amp;gt; %s %ss left %d/%d done&quot; ${period} ${spinner[$count]} ${remaining} ${#completed_pomodoros} ${#goal} 
   137	        sleep 1
   138	        if [ $count -lt 7 ]; then
   139	            ((count++))
   140	        else
   141	            count=0
   142	        fi
   143	    done
   144	
   145	}
   146	
   147	##  This is the main pomodoro screen
   148	show_pom(){
   149	    period=${1}
   150	    length=${2}
   151	    start=$(date +%s)
   152	
   153	    while true; do
   154	        pomo=$(compute $start)
   155	        elapsedsecs=$(compute $start)
   156	        [ ${elapsedsecs} -gt $((length*60)) ] &amp;amp;&amp;amp; return
   157	        elapsed=$(convertsecs $pomo)
   158	        remaining=$(remainingsecs $pomo $length)
   159	
   160	    clear
   161	
   162	cat &amp;lt;&amp;lt;EOF
   163	
   164	
   165	                    Welcome to MyPomodoro!
   166	
   167	        ///////////////  Work Time  ///////////////////////
   168	
   169	        Short break: ${short_break}     Elapsed: ${elapsed}
   170	
   171	        Long break: ${long_break}     Remaining: ${remaining}
   172	
   173	        Goal: ${goal}     Completed: ${completed_pomodoros}
   174	EOF
   175	    sleep 1
   176	    done
   177	}
   178	    
   179	
   180	##  This is the main loop
   181	while true; do
   182	    [ &quot;$runinbar&quot; ] &amp;amp;&amp;amp; show_bar &quot;Work&quot; ${pomodoro} || show_pom &quot;Work&quot; ${pomodoro}
   183	
   184	    completed_pomodoros+=$(completed)
   185	    if  [[  $(( ${#completed_pomodoros} % 4 )) == 0 ]] &amp;amp;&amp;amp; [[ ${#completed_pomodoros} -ne 0 ]]; then
   186	        [ &quot;$runinbar&quot; ] &amp;amp;&amp;amp; play_sound $end_sound &amp;amp;&amp;amp; show_bar &quot;Long_Break&quot; ${long_break} || run_break ${long_break}
   187	    else
   188	        [ &quot;$runinbar&quot; ] &amp;amp;&amp;amp; play_sound $end_sound &amp;amp;&amp;amp; show_bar &quot;Short_Break&quot; ${short_break} || run_break ${short_break}
   189	    fi
   190	    start_time=$(date +%s)
   191	    play_sound $start_sound
   192	done

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;thoughts-on-script&quot;&gt;Thoughts on Script&lt;/h2&gt;

&lt;p&gt;I’m not sure this script will stand, but it seems to work for now.  The idea was to
pass a ‘-b’ argument if it should run in the bar, and pass no arguments if it should
just run in the terminal.  So far, it just runs in the terminal, either in a single
line or on multiple lines.&lt;/p&gt;

&lt;p&gt;Also, I thought I could paste in little watch glyphs using Unicode characters, but
then those didn’t show up on some of my simpler terminal emulators.  So I went back to
just using asterisks.&lt;/p&gt;

&lt;p&gt;There was also the need to check whether the Sox ‘play’ command was installed and
issue a warning if it wasn’t.  The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;command -v&lt;/code&gt; command was of use here.&lt;/p&gt;

&lt;p&gt;The entire script relies on a while loop at the bottom of the script, which calls the
other functions as required.&lt;/p&gt;

&lt;h2 id=&quot;pause&quot;&gt;Pause?&lt;/h2&gt;

&lt;p&gt;Strictly speaking, I don’t think I need a pause command.  The whole idea of Pomodoro
is to concentrate on what you’re doing and &lt;em&gt;not&lt;/em&gt; get side tracked.  If the phone
rings, let the caller leave a message.  If wifey texts, look at it during a break.  If
your kid is stuck by the side of the road, then handle it during a break.  If your
boss interrupts you, well, then it’s up to you how you handle it.  But it seems to me
that adding a pause function is counter-intuitive to what the Pomodoro Technique is
all about.  What do you think?&lt;/p&gt;

&lt;h2 id=&quot;going-forward&quot;&gt;Going Forward&lt;/h2&gt;

&lt;p&gt;I really want to get this running in i3blocks.  I’m not sure whether it’s possible to
get it running in i3status.  So far no luck.  I’ll keep at it.&lt;/p&gt;

&lt;p&gt;I’ve still got some comments in the code to remind me to think about things, like the
‘goal’ string variable.  Is there a way to display the unicode characters for
hourglass or watch in Urxvt for example?  Not sure yet.&lt;/p&gt;

&lt;p&gt;I think Sox is a pretty universal sound player.  It rarely comes pre-packaged with
Linux distributions anymore, but I think it’s available in almost all repos, and has
few if any dependencies.&lt;/p&gt;

&lt;p&gt;This little application has already taken a surprising amount of time to complete thus
far.  And it still doesn’t run in i3blocks!  But I’ve been using it for my
productivity in using i3wm, and it’s easy to run inside of a narrow terminal.&lt;/p&gt;

&lt;p&gt;Hopefully, I’ll get it running inside i3blocks &lt;em&gt;real soon now!&lt;/em&gt;&lt;/p&gt;</content><author><name></name></author><category term="bash" /><category term="timekeeping" /><summary type="html">Creating a Pomodoro in Bash</summary></entry><entry><title type="html">Idea for Teaching Programming</title><link href="/programming/linux/2019/12/23/Idea_for_Teaching_Programming.html" rel="alternate" type="text/html" title="Idea for Teaching Programming" /><published>2019-12-23T13:58:52+00:00</published><updated>2019-12-23T13:58:52+00:00</updated><id>/programming/linux/2019/12/23/Idea_for_Teaching_Programming</id><content type="html" xml:base="/programming/linux/2019/12/23/Idea_for_Teaching_Programming.html">&lt;h2 id=&quot;idea-for-tutoring-in-programming&quot;&gt;Idea for Tutoring in Programming&lt;/h2&gt;

&lt;p&gt;I I just had this idea in a dream, and it sounds pretty great, so
I’m going to flesh it out a bit.&lt;/p&gt;

&lt;h1 id=&quot;several-different-aspects-to-course&quot;&gt;Several Different Aspects To Course&lt;/h1&gt;

&lt;p&gt;My own journey is broad and varied, and the student can get a job
at any point along the way he/she is qualified.&lt;/p&gt;

&lt;p&gt;The course will commence on using UNIX, because that is what
I can teach.  If another person is a Windows programmer, rock on.
But I can teach using Linux.&lt;/p&gt;

&lt;h3 id=&quot;elements&quot;&gt;Elements&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;Learning Linux&lt;/li&gt;
  &lt;li&gt;Learn HTML, CSS, JS and Front-end&lt;/li&gt;
  &lt;li&gt;Get set up and productive with an editor and git&lt;/li&gt;
  &lt;li&gt;Good programmer habits&lt;/li&gt;
  &lt;li&gt;Intro to Web Devel&lt;/li&gt;
  &lt;li&gt;Intro to CSS and Styling&lt;/li&gt;
  &lt;li&gt;Installing a Database&lt;/li&gt;
  &lt;li&gt;Installing Wordpress&lt;/li&gt;
  &lt;li&gt;Intro to JS and jQuery&lt;/li&gt;
  &lt;li&gt;Intro to talking to a Database in JS/jQuery&lt;/li&gt;
  &lt;li&gt;Writing a Simple Backend in Node&lt;/li&gt;
  &lt;li&gt;Writing a Simple React Client&lt;/li&gt;
  &lt;li&gt;Writing a Simple Backend in Ruby Rails&lt;/li&gt;
  &lt;li&gt;Writing a Simple Backend in Python/Flask and Python/Django&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;linux&quot;&gt;Linux&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;Installing Linux&lt;/li&gt;
  &lt;li&gt;Basic Linux Desktop Survival
Basic Desktop Customizing&lt;/li&gt;
  &lt;li&gt;Basic Linux Distribution Survival and Usage&lt;/li&gt;
  &lt;li&gt;Basic Linux System Admin&lt;/li&gt;
  &lt;li&gt;Basic Terminal Commands&lt;/li&gt;
  &lt;li&gt;Basic Vi Editor&lt;/li&gt;
  &lt;li&gt;Basic BASH programs&lt;/li&gt;
  &lt;li&gt;More In Depth Linux System Admin&lt;/li&gt;
  &lt;li&gt;More In Depth BASH Programming&lt;/li&gt;
  &lt;li&gt;Intermediate Vi Editor&lt;/li&gt;
  &lt;li&gt;Intro to Python, Ruby, PHP, and Javascript and Node&lt;/li&gt;
  &lt;li&gt;Installing Git, Getting Comfortable&lt;/li&gt;
  &lt;li&gt;Intro to Servers and Back End Programming
Installing Wordpress, Ruby, Node and Python if necessary&lt;/li&gt;
  &lt;li&gt;Programming Pathways: Frontend, Backend, Wordpress, DevOps&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;intro-to-web-development&quot;&gt;Intro to Web Development&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;First concepts and programs&lt;/li&gt;
  &lt;li&gt;Our Project: A Portfolio&lt;/li&gt;
  &lt;li&gt;Focusing on Structure and Positioning&lt;/li&gt;
  &lt;li&gt;The Psychology of Web Dev: Colors and Flow&lt;/li&gt;
  &lt;li&gt;Finding Teaching Assets on the Web&lt;/li&gt;
  &lt;li&gt;Find other peoples’ projects and portfolios and ideas&lt;/li&gt;
  &lt;li&gt;Solve problems for yourself&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;intro-to-css&quot;&gt;Intro to CSS&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;What is Style?&lt;/li&gt;
  &lt;li&gt;Good style and bad style&lt;/li&gt;
  &lt;li&gt;Your toolbox&lt;/li&gt;
  &lt;li&gt;Where to learn about styling&lt;/li&gt;
  &lt;li&gt;Who are the experts of style and where do you fit?&lt;/li&gt;
  &lt;li&gt;Responsive Style&lt;/li&gt;
  &lt;li&gt;Styling Frameworks&lt;/li&gt;
  &lt;li&gt;SASS&lt;/li&gt;
  &lt;li&gt;BEM&lt;/li&gt;
  &lt;li&gt;Solving some CSS Problems&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;intro-to-javascript-and-jquery&quot;&gt;Intro to Javascript and jQuery&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;Building a front end project from your own idea&lt;/li&gt;
  &lt;li&gt;Getting Started and Gitting going&lt;/li&gt;
  &lt;li&gt;Working with an API&lt;/li&gt;
  &lt;li&gt;…&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;building-a-wordpress-site&quot;&gt;Building a Wordpress Site&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;Installing and First Concepts&lt;/li&gt;
  &lt;li&gt;Styling and Theming Your Site&lt;/li&gt;
  &lt;li&gt;Writing a Wordpress Theme&lt;/li&gt;
  &lt;li&gt;Writing a Wordpress Plugin&lt;/li&gt;
  &lt;li&gt;Being a Wordpress Developer&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;writing-a-backend-in-node&quot;&gt;Writing a Backend in Node&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;Postman and similar clients&lt;/li&gt;
  &lt;li&gt;Understanding HTTP, REST and Databases&lt;/li&gt;
  &lt;li&gt;This is the world of UNIX and Linux&lt;/li&gt;
  &lt;li&gt;More classes on this subject&lt;/li&gt;
  &lt;li&gt;Ideas for Projects&lt;/li&gt;
  &lt;li&gt;Walking Through Using a Simple MongoDB Instance&lt;/li&gt;
  &lt;li&gt;Walking Through Using a Simple Postgres Instance&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;writing-a-simple-react-client&quot;&gt;Writing a Simple React Client&lt;/h3&gt;

&lt;h3 id=&quot;writing-a-backend-in-rubyrails&quot;&gt;Writing a Backend in Ruby/Rails&lt;/h3&gt;

&lt;h3 id=&quot;writing-a-backend-in-pythonflask&quot;&gt;Writing a Backend in Python/Flask&lt;/h3&gt;

&lt;h3 id=&quot;writing-a-backend-in-pythondjango&quot;&gt;Writing a Backend in Python/Django&lt;/h3&gt;

&lt;h3 id=&quot;diving-deeper-into-react-on-the-front-end&quot;&gt;Diving Deeper into React on the Front End&lt;/h3&gt;</content><author><name></name></author><category term="programming" /><category term="linux" /><summary type="html">Idea for Tutoring in Programming</summary></entry><entry><title type="html">The Computer Museum of America</title><link href="/computing/2019/11/21/The_Computer_Museum_of_America.html" rel="alternate" type="text/html" title="The Computer Museum of America" /><published>2019-11-21T16:32:36+00:00</published><updated>2019-11-21T16:32:36+00:00</updated><id>/computing/2019/11/21/The_Computer_Museum_of_America</id><content type="html" xml:base="/computing/2019/11/21/The_Computer_Museum_of_America.html">&lt;h2 id=&quot;computer-museum-in-georgia&quot;&gt;Computer Museum in Georgia&lt;/h2&gt;

&lt;p&gt;I was truly surprised at how awesome this museum is.  It’s a fairly new museum, less than
three years old, and yet it has a massive collection of not just personal machines, but
also super computers and mainframe computers.  There’s also a collection of early DEC
computers, such as the PDP-8 and others, that really bring back memories.  Those were
computers that I had always heard about but had never seen up close.  Those were
computers the elite hackers used and worked on.  In fact, I believe it was a PDP-7 that
Dennis Ritchie and Ken Thompson wrote UNIX on mostly.  Then later they ported it to the
new PDP-11 at Bell labs.  Later they rewrote Unix in the new C language.&lt;/p&gt;

&lt;p&gt;You can read about it &lt;a href=&quot;https://bell-labs.com/var/articles/invention-unix/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The website for the Computer Museum of America is &lt;a href=&quot;https://computermuseumofamerica.org&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As you can see from the website, there’s a lot to see.  There are a lot of old
personal computers and calculators that might be of interest (they were to me),
but what you cannot tell from the website is the depth of the individual exhibits.
It’s one thing to see a picture of a Cray XMP, like we all did in the computer
magazines, but to stand right next to one and look inside a glass side panel is a
completely different experience.  There are a number of Cray’s there in the super
computer exhibit.  There are probably 20 or 30 machines from the late 80s up til
the early 2000s, and a few more recent machines.&lt;/p&gt;

&lt;p&gt;I thought I was computer literate, but looking at those larger machines,
especially the super computers, I felt like I knew nothing.  My experience has
been with microcomputers.  And after looking at those super computers, I feel like
my experience has been very micro.&lt;/p&gt;

&lt;p&gt;For example, I was looking at a heat exchanger from the early 90s, and now I see
that liquid cooling is nothing new on computers.  This heat exchanger was the size
of a small trailer, and it would have been part of the cooling solution.  But it
had see-through panels to you could at least get an idea of what was involved.  I
thought I was cool because I used a liquid AIO to cool my overclocked i7-6700K.
Well, never mind.  I’ll close my mouth and sit quietly after seeing some of these
machines.&lt;/p&gt;

&lt;h1 id=&quot;my-one-criticism&quot;&gt;My One Criticism&lt;/h1&gt;

&lt;p&gt;I could spend days just with the super computers, or perhaps one or two.  It would
be nice to have a kiosk handy with some YouTubes about some of these machines.
The proprietors are not able to leave the panels off of the machines.  And there
cannot always be someone around to answer questions.  But there are so many
questions about these machines, it would be nice to have a FAQ about them.&lt;/p&gt;

&lt;p&gt;Or perhaps there are some more placards on the wall I just haven’t seen that
explain many of these questions.&lt;/p&gt;

&lt;p&gt;One of the questions I have is How do you interface with these machines?  I’m
guessing you log in through a terminal and basically get a terminal prompt, or
perhaps something like an ncurses-type interface.  Occasionally I have logged into
a mainframe, and that’s how it has been with them.  BTW, that’s how it was back in
the 80s too I think.  I didn’t get a lot of mainframe time then, but I got some,
and my exposure was through a TTY emulator.  Perhaps that has not changed?&lt;/p&gt;

&lt;h1 id=&quot;hands-on&quot;&gt;Hands On?&lt;/h1&gt;

&lt;p&gt;My guess is that it takes a lot to get one of these things up and going.  And to
keep it going.  It would probably be easier to get a terminal to a vm running on a
connected Linux box that looks like a supercomputer.  Most people would not
imagine that there’s a difference.&lt;/p&gt;

&lt;p&gt;But some of us are programmers of one kind or another.  I would get a kick out of
writing a fizzbuzz program and running it on a supercomputer.  I imagine others
would too?&lt;/p&gt;

&lt;p&gt;In any event, these supercomputers are like alien technology.  It would be nice to
have a little more background on how they actually work.  Maybe fire one up for a
few minutes?  Solve a complicated math problem on it and compare it to a PCs
number crunching ability?  There’d have to be a really impossible problem to do on
a PC that I could understand and appreciate how much power it would take to solve
it on the supercomputer.  (Understanding it is the key ingredient there.)&lt;/p&gt;

&lt;h1 id=&quot;ill-be-back&quot;&gt;I’ll Be Back&lt;/h1&gt;

&lt;p&gt;If a measure of a museum’s greatness is your intention to go back, then give CMOA
a bunch of stars!  I could spend days in any of the sections of the museum.  One
of the fascinating factums is that what you see in the museum (hundreds of
machines) only represents a small fraction of the owned exhibits.  There are far
more computers that are unseen than there are seen in this museum.  I’m not sure
where they are all stored.  My guess is that the owners are very financially well
off, and they can afford to not only buy pet supercomputers and mainframes, but
also they can afford to store them.  I’m guessing that would be akin to collecting
vintage race cars or airplanes or large military vehicles.  It’s a rich man’s
hobby.&lt;/p&gt;

&lt;p&gt;So, not only will I keep going back to see new things.  I will also go back to
keep trying to plough deeper into the simplest of exhibits there.  I didn’t pay
close enough attention to the devices when I first saw them.  I didn’t realize how
cool they were when they were new.  Now that they old, I’m fascinated by them!&lt;/p&gt;</content><author><name></name></author><category term="computing" /><summary type="html">Computer Museum in Georgia</summary></entry><entry><title type="html">Debian Testing</title><link href="/linux/debian/2019/11/20/Debian_Testing.html" rel="alternate" type="text/html" title="Debian Testing" /><published>2019-11-20T21:05:08+00:00</published><updated>2019-11-20T21:05:08+00:00</updated><id>/linux/debian/2019/11/20/Debian_Testing</id><content type="html" xml:base="/linux/debian/2019/11/20/Debian_Testing.html">&lt;h2 id=&quot;running-debian-testing-as-a-daily-driver&quot;&gt;Running Debian Testing as a Daily Driver&lt;/h2&gt;

&lt;p&gt;I am told this is not a great idea.  However, I’m already running several rolling release 
distros, such as Tumbleweed, Manjaro, and Arch.  My thinking is that Debian Testing branch
is no more unstable than these distros.  Besides, I’ve been at this a while.  I’ve seen a
lot of update-induced problems and have fixed most of them.  Almost all of them in fact.
So since Testing is not even as full of land mines as Debian Unstable, I thought I would
try it out, and it’s been maybe three months?  So far so good.&lt;/p&gt;

&lt;h1 id=&quot;what-about-stable-releases&quot;&gt;What About Stable Releases?&lt;/h1&gt;

&lt;p&gt;Not a problem.  When an Testing release gets moved into the Stable branch, Unstable gets
moved into Testing.  You can read about how the release system works in the Debian Faq.&lt;/p&gt;

&lt;p&gt;Basically, you’ve got the Stable branch.  It is absolutely stable, but if you’re a desktop
user who wants to use very recent software, this branch will leave you feeling left
behind when it comes to the latest software release versions.  For this reason, some
people follow the Testing branch, which provides more recent versions.  However, prior to
a new Debian release, the Testing branch is “frozen”, meaning that little to no changes
are admitted into the Testing branch of Debian.  During this period, developers are
pounding the snot out of the Testing branch to ensure that it is as absolutely stable as
it can possibly be.  Only after this phase does the Testing branch get moved into Stable
in preparation for a new release.&lt;/p&gt;

&lt;h1 id=&quot;why-the-risk&quot;&gt;Why The Risk?&lt;/h1&gt;

&lt;p&gt;It’s purely about running more recent software.  There are many people who do &lt;em&gt;not&lt;/em&gt; need
the latest software, and these people often choose to run the Stable branch.  They
couldn’t care less about running the latest software, and frankly, they couldn’t tell the
difference if you showed them, usually.  That’s fine.  That’s just what you want for
running a rack full of servers.  Those boxes get security updates and that’s about it.
Sometimes they will have uptimes measured in years.  Or at least they used to before
Virtual Machines and containers.  But if you’re running Linux on a home server and you
just want it to do its job for years, then you probably are running the Stable branch.&lt;/p&gt;

&lt;p&gt;However, I want the latest LibreOffice, the latest Nodejs and Python, the latest Cinnamon
desktop, and so on.  I want the latest Nvidia drivers, the latest browsers, and the latest
whizbang goodies.  That’s just me.&lt;/p&gt;

&lt;h1 id=&quot;why-not-run-another-distro-instead&quot;&gt;Why Not Run Another Distro Instead?&lt;/h1&gt;

&lt;p&gt;I do run other distros.  But Debian is one of my old favorites.  I feel I need to stay on
top of that one.  Debian is the launchpad for all of the Ubuntu distros.  And lots of
other Linux distros too.  Staying on top of Debian is essential for keeping your finger on
the upstream pulse of all of those related distros for which Debian is the ancestor.&lt;/p&gt;

&lt;p&gt;The main objection folks have against Debian is that it tends to lag behind on software
versions.  But that’s if you’re running on the Stable branch.  Not so much if you’re
running on Testing.&lt;/p&gt;

&lt;p&gt;Another objection can be related to non-free software.  If you want to run non-free
software, you simply enable non-free repos in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/apt/sources.list&lt;/code&gt; file.  If you
want to run software like Google Chrome and VLC, you can do this.&lt;/p&gt;

&lt;p&gt;Another option to the non-free problem is to use Snap packages.  I prefer snap packages
when running a Debian/Ubuntu distro and Flatpaks when using an RPM distro.  If I’m running
an Arch distro, I normally can find everything I need in the AUR.&lt;/p&gt;

&lt;h1 id=&quot;spotify&quot;&gt;Spotify&lt;/h1&gt;

&lt;p&gt;This is one of those packages that can be kind of confusing, especially if you play files
locally a lot.  Basically, you need legacy versions of ffmpeg decoding software to
translate locally saved files into a version compatible with the latest Spotify version.
Since I play a lot of local files from my Music library, I encounter the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;can't play local
files&lt;/code&gt; bug a lot.  It hasn’t been a problem with a Snap package on Debian so far.  The
standard Debian package did not include the proprietary codecs I needed to play all my
files.  But the Snap did, right off the bat.&lt;/p&gt;

&lt;p&gt;Normally, on other distros, it takes some tinkering to play local files, because each
distro will probably handle these proprietary codecs differently.  But Debian, being one
of the most conservative distros when it comes to non-free software, was a perfect
candidate for the Spotify Snap package.&lt;/p&gt;

&lt;h1 id=&quot;problems&quot;&gt;Problems&lt;/h1&gt;

&lt;p&gt;There have been a few problems.  One fairly large problem was a result of damaging a file
system from repeated overclocking attempts that left the filesystem with lots of errors.
I cannot blame that on Debian or even Linux.  I basically didn’t take enough precautions
with my overclocking (such as maintaining a separate rescue partition).&lt;/p&gt;

&lt;p&gt;Another problem happened when I was upgrading a module from the Nvidia driver.  It turned
out that one of the kernel modules wouldn’t build, and it quietly bombed out and resulted
in a driver module that couldn’t be inserted into the current kernel.&lt;/p&gt;

&lt;p&gt;This was an easy fix, once I read the errors and googled them.  Fortunately, this time,
that particular error was the result of a change in how the linux kernel manages video
drivers.  After a certain kernel version, a version check must be made to see whether it
is appropriate to build a module dependency or not.  Prior to that kernel version, it was
the default behavior to build that module.  After that version, you would not build the
module with the same dependencies.  This change resulted in placing an if/then statement
around the block of code where this module dependency was built before.  I think it was
four lines of code that needed to be added.  The github issues page I was reading
contained the four lines of code, so I added them to my nvidia module’s source tree.
Poof!  The modules built and installed flawlessly after that.  No problems.&lt;/p&gt;

&lt;p&gt;A week or two later, this fix was included in a formal update for the Testing branch.  I
would have been good to go in about a week and a half anyway.  Fortunately, I didn’t have
to wait that long.&lt;/p&gt;

&lt;h1 id=&quot;who-should-run-testing&quot;&gt;Who Should Run Testing?&lt;/h1&gt;

&lt;p&gt;I would say run testing if you need the latest software versions.  But be advised that
you’ll get problems.  If you’re okay with working through problems, then fine.&lt;/p&gt;

&lt;p&gt;Be sure to keep a backup of your system!!!&lt;/p&gt;

&lt;p&gt;That said, I have really just had these two little problems.  Well, the first one resulted
in a reinstall, because I didn’t keep backups on this machine!  (It’s a machine that I
overclock on a fair amount!)&lt;/p&gt;

&lt;p&gt;The nvidia problem was a typical problem that you might get on the Testing branch.  There
could be other ones, and those problems might not get resolved with 10 minutes of
Googling.  I can take longer.  I’ve been fortunate.  But this is how I treat any rolling
release distribution.  I normally don’t get many problems from them, but when they happen,
they are not fun.  If you do not have backups or have alternate machines you can use to
get work done, it ain’t fun.  I have lots of alternative machines I can use.  If one
breaks, it’s not a problem for me to use another until I get the broken machine fixed.  In
fact, I normally have &lt;em&gt;at least one&lt;/em&gt; machine that is broken.&lt;/p&gt;

&lt;p&gt;So, the Testing branch is not a problem for me.  I still can curse when it breaks, but I
realize I have said yes to these problems when I run a bleeding edge release.&lt;/p&gt;

&lt;p&gt;For absolute stability, I recommend an LTS release of Ubuntu which are based on Debian
Stable.  Also, Linux Mint tends to be based on an LTS release and inherits great stability
from Debian.  And then running Debian Stable itself is about as stable as you can get.&lt;/p&gt;

&lt;p&gt;If you really don’t mind running software versions that are &lt;em&gt;not&lt;/em&gt; the lastest and
greatest, you should try out Debian Stable.  If it turns out it’s not recent enough, try
running Debian Testing and see what happens!  All the best in your journey!&lt;/p&gt;</content><author><name></name></author><category term="Linux" /><category term="Debian" /><summary type="html">Running Debian Testing as a Daily Driver</summary></entry><entry><title type="html">Overclocking On Linux</title><link href="/linux/overclocking/2019/11/15/Overclocking_On_Linux.html" rel="alternate" type="text/html" title="Overclocking On Linux" /><published>2019-11-15T14:25:10+00:00</published><updated>2019-11-15T14:25:10+00:00</updated><id>/linux/overclocking/2019/11/15/Overclocking_On_Linux</id><content type="html" xml:base="/linux/overclocking/2019/11/15/Overclocking_On_Linux.html">&lt;h2 id=&quot;linux-as-an-overclocking-platform&quot;&gt;Linux as an Overclocking Platform&lt;/h2&gt;

&lt;p&gt;I’ve recently gotten into overclocking some of my computers.  I’ve always been weary to
do this, because it seemed like a great way to ruin perfectly good hardware and throw
money down the drain.  So, no overclocking for me.  Until now.&lt;/p&gt;

&lt;p&gt;I looked around and saw that I simply had too much hardware.  And it has finally begun
to dawn on me that there is quite a bit of headroom built into CPUs these days.  No one
can predict the performance potential of a randomly binned CPU.  So there is a sort of
CPU lottery.  Maybe you win, or maybe you don’t.  But there is going to be at least some
potential performance your CPU in your computer will have beyond what it’s currently
doing if you are willing to push it a little bit.  And, frankly, I got curious.  That’s
how these things always start for me.  I get curious.&lt;/p&gt;

&lt;p&gt;There is one more aspect to all this.  I made a promise to myself to not buy anymore
computers.  I probably have about 20 or more towers at my house, mostly all running
linux.  I figured if I’m not buying any more new CPUs, I’ve got to stay busy with what
I’ve got, and my attention turned to performance.  If I can get some of these boards and
CPUs to wear out or something, then I might buy new stuff???&lt;/p&gt;

&lt;h1 id=&quot;what-is-overclocking-anyway&quot;&gt;What is Overclocking Anyway?&lt;/h1&gt;

&lt;p&gt;There’s really nothing special about overclocking.  It’s simply pushing your CPU a
little harder for greater speed, and that usually requires more voltage.  Since CPUs and
the chips on your motherboard are so small, they are vulnerable to heat, so small
increases in voltage can place your motherboard and CPU at some risk if you don’t think
about what you’re doing.  After all, you could have paid many hundreds of dollars for
those components, so why would you want to cook them inside of your tower case?&lt;/p&gt;

&lt;p&gt;Well depending on your specific CPU and motherboard, you could get a 10-20% performance
bump in your system.  For free, basically.  I’ve finally had some systems that are 15
plus years old die on me.  Either a drive controller or mobo component dies or
something, but this has been long &lt;em&gt;after&lt;/em&gt; that system has been a highly useful system
for me.  My point is, why not get more use out of that hardware since you’re going to
replace it long before it physically dies anyway?  Overclocking is one way to do that.&lt;/p&gt;

&lt;p&gt;Specifically, to overclock, you must have an unlocked CPU (one that allows you to change
speeds and voltages) and a motherboard that supports overclocking.  Likewise, you’re
going to need a good power supply with at least a Bronze level rating, and also a good
cooling solution, probably an after market cooler, to dissipate the increased heat.&lt;/p&gt;

&lt;p&gt;An example of an overclock is taking an i5-4790K cpu on an ASRock Z97 Extreme6 board (a
little more expensive motherboard that is good at overclocking) and changing the default
multiplier in the BIOS so that the CPU speed goes from 3.5GHz to 4.5GHz.  Core voltage
could need to go up an extra 0.125 volts or so to keep this clock stable.  So instead of
an idle temperature of, say, 30 degrees Centigrade, perhaps you’re now running closer to
40 degrees at idle.  You haven’t spent a dime, unless you’ve upgraded some of your
components.&lt;/p&gt;

&lt;p&gt;This boost from 3.5GHz to 4.5GHz is almost a 30% increase in CPU speed.  And it’s
costing you perhaps an extra few pennies in your monthly energy bill.  Can you begin to
see why the idea might be attractive to people?&lt;/p&gt;

&lt;h1 id=&quot;but-is-it-practical&quot;&gt;But is it Practical?&lt;/h1&gt;

&lt;p&gt;That depends.  If all you do is surf the web and read email, then probably not.  If you
just want to watch YouTube videos on your machine, then overclocking probably won’t be
of interest to you.  But, if you use your CPU cycles on things, such as playing
intensive computer games or rendering videos or compiling source trees or something, then
overclocking your CPU might be something of interest to you.&lt;/p&gt;

&lt;p&gt;For me, sometimes I write computer programs that require compute power.  For example, if
I’m searching for prime numbers, I can easily bring a system to its knees.  These are
just intensive calculations, and some operations can take a very long time.  In fact,
there’s a “Great Search for Mersenne Primes” on the internet, and it requires so much
compute power that there are thousands (or more?) volunteers sharing their computers’
extra CPU cycles in the search.  The software you download is also great for stress
testing your system for stability.  If you can run the stress test and keep your system
stable at higher clocks and voltages, searching for prime numbers is a great way to test
your experimental settings.  This software is called &lt;a href=&quot;https://mersenne.org/download&quot;&gt;Prime95&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First and foremost, it’s fun.  Overclocking is like hot rodding your computer.  You may
or may not notice the performance gains you’ll realize.&lt;/p&gt;

&lt;h1 id=&quot;is-it-safe&quot;&gt;Is It Safe?&lt;/h1&gt;

&lt;p&gt;I believe that depends on you.  Are you safe?  Can you experiment safely?  If you can
trust yourself to be careful and pay attention and be patient, then yes, overclocking is
safe.  If you tend to do things like run around with sharp knives or drive too fast or
hit live ammunition with hammers just for fun, then overclocking your computer may not
be for you.  However, if you can do research and learn the meanings of BIOS/UEFI
settings for your motherboard, then you can safely realize these performance gains from
overclocking.&lt;/p&gt;

&lt;p&gt;Basically, you’ll &lt;em&gt;need&lt;/em&gt; the things I mentioned earlier:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;An unlocked CPU&lt;/li&gt;
  &lt;li&gt;A motherboard that supports overclocking&lt;/li&gt;
  &lt;li&gt;A good power supply (80 plus Bronze or better)&lt;/li&gt;
  &lt;li&gt;A good cooling solution&lt;/li&gt;
&lt;/ol&gt;

&lt;h1 id=&quot;is-water-cooling-necessary&quot;&gt;Is Water Cooling Necessary?&lt;/h1&gt;

&lt;p&gt;Water cooling is not necessary but it can be more efficient than air cooling.  Water can
dissipate thermal energy more efficiently than air, or so I hear.  But if you’re
comparing a small 120mm water cooler to a huge heat sink with multiple fans moving air
through the heat sink, then the air cooler will be better.&lt;/p&gt;

&lt;p&gt;TDP or “thermal design profile” is a measurement of the maximum heat a CPU or a Cooler
can handle.  It can be a basic indicator for how much cooling capability a cooler has.
If your air cooler can handle 150W TDP and your 120mm AIO can handle 130W TDP, then your
air cooler is a better solution.  But is it so big that it doesn’t fit into your box?
Maybe the biggest heat sink that fits into your box has a TDP of 120W.&lt;/p&gt;

&lt;p&gt;This brings up an interesting point:  there are a LOT of great cooling solutions these
days in either water or liquid coolers.  In general, air coolers must sit on top of the
CPU, which limits the size of the heat sink that can be used.  Water coolers can use
tubes to move the hot water through radiators that can be placed anywhere in the
computer.  You can even use multiple radiators if you so desire.  So liquid coolers have
more potential in terms of how much heat they can dissipate in your system.  But all
this depends on your use case.  Do you just want to run a massive overclock and build a
custom loop cooling solution just so you can show off your high clocks to your friends?
You’ll probably want to build a custom loop with multiple radiators, and perhaps you can
even overclock your GPU (graphics card) also and include that in your custom loop?&lt;/p&gt;

&lt;p&gt;But if all your after is a 10-15% increase in clock speed, there are lots of air coolers
that will keep your system simple and do the cooling job reliably.  There are also
exceptional air coolers with smaller form factors.  And there are AIOs for nearly every
case.  But, size will be a factor in your solution.&lt;/p&gt;

&lt;h1 id=&quot;why-linux&quot;&gt;Why Linux?&lt;/h1&gt;

&lt;p&gt;Well for me, I use Linux.  Linux is as familiar to me as Mac and Windows are to many
people.  But most people who post on overclocking forums seem to be using Windows.  I’m
not aware of anyone who overclocks on Mac, unless we’re talking about Hackintoshes.  And
I’m not sure Apple hardware even has a BIOS that you can change settings on.  So that
would prevent overclocking on Apple hardware I think.  But since most people who
overclock do it on Windows, you just need the Linux equivalents of those software
choices for your Linux machine:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Prime95&lt;/li&gt;
  &lt;li&gt;CPU-Z for linux&lt;/li&gt;
  &lt;li&gt;HWMonitor for Linux&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Slight problem.  CPU-Z and HWMonitor (available for Windows at cpuid.com) are not
available for Linux.  However, there are alternatives for these options on Linux.  It’s
not worth it for me to run Windows just so I can run these pieces of software.&lt;/p&gt;

&lt;p&gt;Prime95 is available as a CLI program on Linux.  I can monitor fan speeds, temperatures,
clock cycles and load percentages also with CLI programs or scripts.  If you’re willing
to do that, then you can get about the same information on Linux as you can on Windows.
You can google “CPU-Z for Linux” or “HWMonitor for Linux” and find lots of alternatives.&lt;/p&gt;

&lt;p&gt;If you’re running Ubuntu you may have a few graphical options available that haven’t
been packaged to other distros.&lt;/p&gt;

&lt;p&gt;I frequently just use GKrellM or Conky.&lt;/p&gt;

&lt;h1 id=&quot;first-steps&quot;&gt;First Steps&lt;/h1&gt;

&lt;p&gt;It’s going to start with your particular hardware.  Are you using hardware that is
capable of overclocking?  If not, you’re done.&lt;/p&gt;

&lt;p&gt;Is the payoff worth the risk in your case?  If you’re already a tinkerer and have
hardware you can afford to experiment with, then great.  If you don’t want to risk your
hardware, then stop now.&lt;/p&gt;

&lt;p&gt;If you’re good to go, start with Google.  I googled “Overclocking on Linux” and came up
with LOTS of very interesting links worth reading.  Lots of opinions out there.&lt;/p&gt;

&lt;p&gt;Watch YouTubes about overclocking on Windows too.  Overclocking happens really more at
the BIOS level, so the OS is really more of a window to whatever is happening at that
lower level of the machine.  You can learn a lot from Windows TechTubers, such as
JayzTwoCents, Pauls Hardware, Bitwit, LinusTechTips, and many, many others.  There are
tons of people out there doing this, so you are joining a huge group of people who have
been overclocking for a long time.&lt;/p&gt;

&lt;h1 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h1&gt;

&lt;p&gt;If you’re the type of person who likes building computers or building things with
software, you might also be the type of person who enjoys hot rodding their computer.&lt;/p&gt;

&lt;p&gt;There’s some risk.  But you could also drop a $500 CPU on the hardwood floor while
you’re building a computer.  Or you could accidentally spill your milkshake on your
motherboard.  If you have been willing to handle those risks, then overclocking might
not be much more of a risk for you.&lt;/p&gt;

&lt;p&gt;If you’ve ever run benchmarks on your system to see “how did I do?” then you might be a
candidate for overclocking.  Overclocking your computer is a great way to get higher
scores on various benchmarks.  It’s also a great way to measure your performance gains
from overclocking.  There are lots of benchmarks out there, and Google is your friend
here.&lt;/p&gt;

&lt;p&gt;Linux has tended to be a production type of platform, especially for servers and getting
work done in the background.  But if you’ve been using Linux as a desktop solution
instead of Windows or Mac, then why change to Windows just for overclocking?&lt;/p&gt;

&lt;p&gt;Finally, I have not mentioned specific software solutions for CPU-Z and HWMontor.
That’s because your choices would probably not be my choices.  Desktop Linux is full of
different environments and window managers and toolkits and technology stacks.  There
isn’t one solution that fits everybody.  If you’re already using Linux then you probably
already know this.  CPU-X may or may not work as a substitute for CPU-Z on Windows.  You
may well find that writing your own script that monitors &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/proc/cpuinfo&lt;/code&gt; works better
than anything else.  Sometimes Conky or GKrellM is enough for me to watch while I
overclock.  Your mileage may vary!&lt;/p&gt;

&lt;p&gt;One thing I can tell you, I have been having lots of fun overclocking on Linux.&lt;/p&gt;</content><author><name></name></author><category term="Linux" /><category term="Overclocking" /><summary type="html">Linux as an Overclocking Platform</summary></entry><entry><title type="html">Migrating Antergos to Arch Linux</title><link href="/linux/arch/antergos/2019/11/01/Migrating_Antergos_to_Arch_Linux.html" rel="alternate" type="text/html" title="Migrating Antergos to Arch Linux" /><published>2019-11-01T15:23:07+00:00</published><updated>2019-11-01T15:23:07+00:00</updated><id>/linux/arch/antergos/2019/11/01/Migrating_Antergos_to_Arch_Linux</id><content type="html" xml:base="/linux/arch/antergos/2019/11/01/Migrating_Antergos_to_Arch_Linux.html">&lt;h1 id=&quot;migrating-antergos-linux-to-arch-linux&quot;&gt;Migrating Antergos Linux to Arch Linux&lt;/h1&gt;

&lt;p&gt;Since the Antergos project eneded, those of us who have loved Antergos have been sad.&lt;/p&gt;

&lt;p&gt;And there was an Antergos forum post about future updates magically updating or migrating
Antergos installations to Arch Linux installations.  Well, that may not have happened so
magically, and I guess no one ever really promised us Linux magic, especially with an Arch
related distro, so we have to spin up our own magic I guess.  Hopefully, this article can
provide a bit of that.&lt;/p&gt;

&lt;p&gt;I’m writing this on the first day of November, 2019, and the project ended in late May.  So there have
been updates that have helped to change existing Antergos installations into Almost Arch installations.
But there are a few things that still need to happen. Here’s a recipe for converting your
Antergos installation into a working Arch installation:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Logout of you desktop so you see your X display manager login.  Then hit
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ALT-CTL-F2&lt;/code&gt; and log into your account and become root:
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;su -
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;Change to multi-user (non-graphical) run level.
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# systemctl start multi-user.target
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;Remove the pamac graphical package manager.
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# kill -s SIGKILL $(pgrep pamac) &amp;amp;&amp;amp; pacman -R pamac
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;Remove all antergos packages (if you want a pure Arch installation).
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# pacman -Rddnus $(pacman -Qq | grep antergos)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Modify /etc/pacman.conf to remove references to Antergos repos.
Just comment out all sections with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[antergos]&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[antergos-staging]&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Change entries in /etc/os-release (which is a symlink /usr/lib/os-release) over to Arch values
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; NAME=&quot;Arch Linux&quot;
 PRETTY_NAME=&quot;Arch Linux&quot;
 ID=archlinux
 ID_LIKE=archlinux
 ANSI_COLOR=&quot;0;36&quot;
 HOME_URL=&quot;https://archlinux.org/&quot;
 SUPPORT_URL=&quot;https://bbs.archlinux.org/&quot;
 BUG_REPORT_URL=&quot;https://bugs.archlinux.org&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;Update your system:
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# pacman -Syyu
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;If when you run neofetch or screenfetch you still see Antergos, then you should re-install
the lsb-release package
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# pacman -S lsb-release
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Make sure you have all required files for your desktop environment, including all Xorg and related
files, video drivers, mesa, etc etc, which are now coming from Arch repos.  May need to
re-install from new repos.  One of my machines had Cinnamon (desktop) antergos repos, so I
had to remove all of those and get regular arch packages.  Just to be safe, I re-installed
all my xorg packages along with lightdm packages and my video drivers.  This time I knew
they all came from arch repos.&lt;br /&gt;
&lt;a href=&quot;https://www.tecmint.com/install-cinnamon-desktop-in-arch-linux&quot;&gt;This article&lt;/a&gt;
explains the process for Cinnamon. This particular article is good, but it is old (2014).
Packages names can change a lot!&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Change grub theme to an arch linux theme, if that’s what you want. Remove Antergos grub
   theme.  (Should already be gone.) When you install grub from arch repos, it may not
   overwrite your existing antergos &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/default/grub.cfg&lt;/code&gt;.  If not, there should be
   another grub.cfg in /etc/default that has a different name, like grub.cfg.pacman or
   something.  Look at them both and make sure the correct one is in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/default/grub.cfg&lt;/code&gt;.
   I would also install a grub theme, such as grub2-theme-archlinux.
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# yay -S grub2-theme-archlinux
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    &lt;p&gt;Then, run&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# grub-mkconfig -o /boot/grub/grub.cfg
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    &lt;p&gt;If there are no errors, you should be good for a reboot, almost.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Restart your graphical target run level.
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# systemctl start graphical.target
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    &lt;p&gt;If there are any missing X related packages, you can troubleshoot your errors and
   straighten them out.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;When youre ready, reboot your computer, if you dare!&lt;/li&gt;
&lt;/ol&gt;

&lt;h1 id=&quot;leftovers&quot;&gt;Leftovers&lt;/h1&gt;

&lt;p&gt;If you installed Antergos using LVM, you’ll still see &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Antergos&lt;/code&gt; in your LVM names.  There
are still some packages on your system, such as webkit-theme-antergos, and you can see some
more using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;updatedb &amp;amp;&amp;amp; locate antergos&lt;/code&gt;.  But for all intents and purposes, you now
should have an arch linux installation.  Those remaining files weren’t removed when antergos
packages were removed, but they can be removed manually I think without affecting the rest of
the system.  But I’m not sure.  For now, they’re not bothering me.  Maybe I’ll remove them
later.&lt;/p&gt;

&lt;p&gt;I’ve changed my icons around to reflect the change, in my start menu for example.  Neofetch
and Screenfetch now report an Arch installation.  And really, there’s just very little left
of Antergos in the installation.  Linux distros are simply a collection of choices, and
Antergos was mainly a collection of very nice styling decisions and special packages, and
those packages are now replaced by Arch packages.  And you’re free to keep the best choices
for your indidualized Arch installation!&lt;/p&gt;</content><author><name></name></author><category term="linux" /><category term="arch" /><category term="antergos" /><summary type="html">Migrating Antergos Linux to Arch Linux</summary></entry></feed>