Site Map - skip to main content - dyslexic font - mobile - text - print

Hobby Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


Correspondent

b-yeezi

Host Image
Host ID: 300

I am a dad, small-business owner, scientist, and Linux enthousiast with a lust for knowledge. You can find me on reddit at https://www.reddit.com/user/b-yeezi/ or look for @ryoung29 on twitter.


email: by33zi.nospam@nospam.protonmail.com
episodes: 16

hpr2389 :: Thoughts on Lifetime Learning

Released on 2017-09-28 under a CC-BY-SA license.

Thoughts on Lifetime Learning

For some of my other thoughts on this topic, consider reading this blog post.


hpr2333 :: VirtualenvWrapper for Fish Shell

Released on 2017-07-12 under a CC-BY-SA license.

In this episode, talk about how I created my own virtualenvwrapper-like interface using Fish Shell.

Fish Shell is "a smart and user-friendly command line shell for macOS, Linux, and the rest of the family. It excels in tab completion and ease of use, but virtualenvwrapper does not support it.

Virtualenvwrapper, like the name suggests, is a wrapper around python's virtualenv functionality, which allows you to use different versions of python packages in separate environments. To learn more, listen to BJB's show called A bit of background on virtualenvwrapper.

Functions and aliases in my fish config file:

# Set virtual directory root
export set WORKON_HOME=$HOME/Envs

# List virtual environments
alias lsenvs="ls -m $WORKON_HOME | sed 's/\///g'"

# Create python2 virtual environment
function -d "Like virtualenvwrapper for python2" mkvirtualenv2
    virtualenv -p python2 $WORKON_HOME/$argv;
    and source $WORKON_HOME/$argv/bin/activate.fish;
    and echo "Virtual environment created."
end

# Create python3 virtual environment
function -d "Like virtualenvwrapper" mkvirtualenv
    virtualenv -p python3 $WORKON_HOME/$argv;
    and source $WORKON_HOME/$argv/bin/activate.fish;
    and echo "Virtual environment created."
end

# Source a virtual environment
function workon
    source $WORKON_HOME/$argv/bin/activate.fish; and echo "Switch to virtual environment."
end

# Delete a virtual environment
function -d "Like virtualenvwrapper" rmvirtualenv
    if test -n "$VIRTUAL_ENV"
        deactivate
    end
    rm -rf $WORKON_HOME/$argv; and echo "Virtual environment deleted."
end

hpr2330 :: Awk Part 7

Released on 2017-07-07 under a CC-BY-SA license.

In this episode, I will (very) briefly go over loops in the Awk programming language. Loops are useful when you want to run the same command(s) on a collection of data or when you just want to repeat the same commands many times.

When using loops, a command or group of commands is repeated until a condition (or many) is met.

While Loop

Here is a silly example of a while loop:

#!/bin/awk -f
BEGIN {

# Print the squares from 1 to 10 the first way

    i=1;
    while (i <= 10) {
        print "The square of ", i, " is ", i*i;
        i = i+1;
    }

exit;
}

Our condition is set in the braces after the while statement. We set a variable, i, before entering the loop, then increment i inside of the loop. If you forget to make a way to meet the condition, the while will go on forever.

Do While Loop

Here is an equally silly example of a do while loop:

#!/bin/awk -f
BEGIN {

    i=2;
    do {
        print "The square of ", i, " is ", i*i;
        i = i + 1
    }

    while (i != 2)

exit;
}

Here, the commands in the do code block are executed at the start, then the looping begins.

For Loop

Another silly example of a for loop:

#!/bin/awk -f
BEGIN {

    for (i=1; i <= 10; i++) {
        print "The square of ", i, " is ", i*i;
    }

exit;
}

As you can see, we set the variable, set the condition and set the increment method all in the braces after the for statement.

For Loop Over Arrays

Here is a more useful example of a for loop. Here, we are adding the different values of column 2 into an array/hash-table called a. After processing the file, we print the different values.

For file.txt:

name       color  amount
apple      red    4
banana     yellow 6
strawberry red    3
grape      purple 10
apple      green  8
plum       purple 2
kiwi       brown  4
potato     brown  9
pineapple  yellow 5

Using the awk file of:

NR != 1 {
    a[$2]++
}
END {
    for (b in a) {
        print b
    }
}

We get the results of:

brown
purple
red
yellow
green

In another example, we do a similar process. This time, not only do we store all the distinct values of the second column, we perform a sum operation on column 3 for each distinct value of column 2.

For file.csv:

name,color,amount
apple,red,4
banana,yellow,6
strawberry,red,3
grape,purple,10
apple,green,8
plum,purple,2
kiwi,brown,4
potato,brown,9
pineapple,yellow,5

Using the awk file of:

BEGIN {
    FS=",";
    OFS=",";
    print "color,sum";
}
NR != 1 {
    a[$2]+=$3;
}
END {
    for (b in a) {
        print b, a[b]
    }
}

We get the results of:

color,sum
brown,13
purple,12
red,7
yellow,11
green,8

As you can see, we are also printing a header column prior to processing the file using the BEGIN code block.


hpr2236 :: Hoarding Raspberry Pis

Released on 2017-02-27 under a CC-BY-SA license.

Show Notes

In this episode, I discuss my growing obsession with building a Raspberry Pi data center.

Tower of Pi

Items referenced in this episode:

Hope this was enjoyable, if not, informative!


hpr2184 :: Gnu Awk - Part 5

Released on 2016-12-15 under a CC-BY-SA license.

GNU AWK - Part 5

Regular Expressions in AWK

The syntax for using regular expressions to match lines in AWK is as follows:

word ~ /match/

Or for not matching, use the following:

word !~ /match/

Remember the following file from the previous episodes:

name       color  amount
apple      red    4
banana     yellow 6
strawberry red    3
grape      purple 10
apple      green  8
plum       purple 2
kiwi       brown  4
potato     brown  9
pineapple  yellow 5

We can run the following command:

$1 ~ /p[elu]/ {print $0}

We will get the following output:

apple      red    4
grape      purple 10
apple      green  8
plum       purple 2
pineapple  yellow 5

In another example:

$2 ~ /e{2}/ {print $0}

Will produce the output:

apple      green  8

Regular expression basics

Certain characters have special meaning when using regular expressions.

Anchors

  • ^ - beginning of the line
  • $ - end of the line
  • \A - beginning of a string
  • \z - end of a string
  • \b on a word boundary

Characters

  • [ad] - a or d
  • [a-d] - any character a through d
  • [^a-d] - not any character a through d
  • \w - any word
  • \s - any white-space character
  • \d - any digit

The capital version of w, s, and d are negations.

Or, you can reference characters the POSIX standard way:

  • [:alnum:] - Alphanumeric characters
  • [:alpha:] - Alphabetic characters
  • [:blank:] - Space and TAB characters
  • [:cntrl:] - Control characters
  • [:digit:] - Numeric characters
  • [:graph:] - Characters that are both printable and visible (a space is printable but not visible, whereas an ‘a’ is both)
  • [:lower:] - Lowercase alphabetic characters
  • [:print:] - Printable characters (characters that are not control characters)
  • [:punct:] - Punctuation characters (characters that are not letters, digits, control characters, or space characters)
  • [:space:] - Space characters (such as space, TAB, and formfeed, to name a few)
  • [:upper:] - Uppercase alphabetic characters
  • [:xdigit:] - Characters that are hexadecimal digits

Quantifiers

  • . - match any character
  • + - match preceding one or more times
  • * - match preceding zero or more times
  • ? - match preceding zero or one time
  • {n} - match preceding exactly n times
  • {n,} - match preceding n or more times
  • {n,m} - match preceding between n and m times

Grouped Matches

  • (...) - Parentheses are used for grouping
  • | - Means or in the context of a grouped match

Replacement

  • The sub command substitutes the match with the replacement string. This only applies to the first match.
  • The gsub command substitutes all matching items.
  • The gensub command command substitutes the in a similar way as sub and gsub, but with extra functionality
  • The & character in the replacement field references the matched text. You have to use \& to replace the match with the literal & character.

Example:

{ sub(/apple/, "nut", $1);
    print $1}

The output is:

name
nut
banana
strawberry
grape
nut
plum
kiwi
potato
pinenut

Another example:

{ sub(/.+(pp|rr)/, "test-&", $1);
    print $1}

This produces the following output:

name
test-apple
banana
test-strawberry
grape
test-apple
plum
kiwi
potato
test-pineapple

Resources


hpr2143 :: Gnu Awk - Part 3

Released on 2016-10-19 under a CC-BY-SA license.

Awk Part 3

Remember our file:

name       color  amount
apple      red    4
banana     yellow 6
strawberry red    3
grape      purple 10
apple      green  8
plum       purple 2
kiwi       brown  4
potato     brown  9
pineapple  yellow 5

Replace Grep

As we saw in earlier episodes, we can use awk to filter for rows that match a pattern or text. If you know the grep command, you know that it does the same function, but has extended capabilities. For simple filter, you don't need to pipe grep outputs to awk. You can just filter in awk.

Logical Operators

You can use logical operators "and" and "or" represented as "&&" and "||", respectively. See example:

$2 == "purple" && $3 < 5 {print $1}

Here, we are selecting for color to to equal "purple" AND amount less than 5.

Next command

Say we want to flag every record in our file where the amount is greater than or equal to 8 with a '**'. Every record between 5 (inclusive) and 8, we want to flag with a '*'. We can use consecutive filter commands, but there affects will be additive. To remedy this, we can use the "next" command. This tells awk that after the action is taken, proceed to the next record. See the following example:

NR == 1 {
  print $0;
  next;
}

$3 >= 8 {
  printf "%s\t%s\n", $0, "**";
  next;
}

$3 >= 5 {
  printf "%s\t%s\n", $0, "*";
  next;
}

$3 < 5 {
  print $0;
}

End Command

The "BEGIN" and "END" commands allow you to do actions before and after awk does its actions. For instance, sometimes we want to evaluate all records, then print the cumulative results. In this example, we pipe the output of the df command into awk. Our command is:

df -l | awk -f end.awk

Our awk file looks like this:

$1 != "tempfs" {
    used += $3;
    available += $4;
}

END {
    printf "%d GiB used\n%d GiB available\n", used/2^20, available/2^20;
}

Here, we are setting two variables, "used" and "available". We add the records in the respective columns all together, then we print the totals.

In the next example, we create a distinct list of colors from our file:

NR != 1 {
    a[$2]++
}
END {
    for (b in a) {
        print b
    }
}

This is a more advanced script. The details of which, we will get into in future episodes.

BEGIN command

Like stated above, the begin command lets us print and set variables before the awk command starts. For instance, we can set the input and output field separators inside our awk file as follows:

BEGIN {
    FS=",";
    OFS=",";
    print "color,count";
}
NR != 1 {
    a[$2]+=1;
}
END {
    for (b in a) {
        print b, a[b]
    }
}

In this example, we are finding the distinct count of colors in our csv file, and format the output in csv format as well. We will get into the details of how this script works in future episodes.

For another example, instead of distinct count, we can get the sum of the amount column grouped by color:

BEGIN {
    FS=",";
    OFS=",";
    print "color,sum";
}
NR != 1 {
    a[$2]+=$3;
}
END {
    for (b in a) {
        print b, a[b]
    }
}

hpr2140 :: Vim Plugins I Use

Released on 2016-10-14 under a CC-BY-SA license.

Vim Plugins I Use


hpr2114 :: Gnu Awk - Part 1

Released on 2016-09-08 under a CC-BY-SA license.

Introduction to Awk

Awk is a powerful text parsing tool for unix and unix-like systems.

The basic syntax is:

awk [options] 'pattern {action}' file

Here is a simple example file that we will be using, called file1.txt:

name       color  amount
apple      red    4
banana     yellow 6
strawberry red    3
grape      purple 10
apple      green  8
plum       purple 2
kiwi       brown  4
potato     brown  9
pineapple  yellow 5

First command:

awk '{print $2}' file1.txt

As you can see, the “print” command will display the whatever follows. In this case we are showing the second column using “$2”. This is intuitive. To display all columns, use “$0”.

This example will output:

color
red
yellow
red
purple
green
purple
brown
brown
yellow

Second command:

awk '$2=="yellow"{print $1}' file1.txt

This will output:

banana
pineapple

As you can see, the command matches items in column 2 matching “yellow”, but prints column 1.

Field separator

By default, awk uses white space as the file separator. You can change this by using the -F option. For instance, file1.csv looks like this:

name,color,amount
apple,red,4
banana,yellow,6
strawberry,red,3
grape,purple,10
apple,green,8
plum,purple,2
kiwi,brown,4
potato,brown,9
pineapple,yellow,5

A similar command as before:

awk -F"," '$2=="yellow" {print $1}' file1.csv

will still output:

banana
pineapple

Regular expressions work as well:

awk '$2 ~ /p.+p/ {print $0}' file1.txt

This returns:

grape   purple  10
plum    purple  2

Numbers are interpreted automatically:

awk '$3>5 {print $1, $2}' file1.txt

Will output:

name    color
banana  yellow
grape   purple
apple   green
potato  brown

Using output redirection, you can write your results to file. For example:

awk -F, '$3>5 {print $1, $2} file1.csv > output.txt

This will output a file with the contents of the query.

Here’s a cool trick! You can automatically split a file into multiple files grouped by column. For example, if I want to split file1.txt into multiple files by color, here is the command.

awk '{print > $2".txt"}' file1.txt

This will produce files named yellow.txt, red.txt, etc. In upcoming episodes, we will show how to improve the outputs.

Resources

  1. http://www.theunixschool.com/p/awk-sed.html
  2. http://www.tecmint.com/category/awk-command/
  3. http://linux.die.net/man/1/awk

Coming up

  • More options
  • Built-in Variables
  • Arithmetic operations
  • Awk language and syntax

hpr2091 :: Everyday Unix/Linux Tools for data processing

Released on 2016-08-08 under a CC-BY-SA license.

Here are some of the tools I use to process and clean data from all manner of customers:

detox

The detox utility renames files to make them easier to work with. It removes spaces and other such annoyances. It’ll also translate or cleanup Latin-1 (ISO 8859-1) characters encoded in 8-bit ASCII, Unicode characters encoded in UTF-8, and CGI escaped characters.

See other episodes for great sed information. I like to remove DOS end of line and end of file characters:

sed -i 's/
//g' *.txt

or

sed -i 's/\r//g' *.txt

Command-line tools

  • ack
  • awk
  • detox
  • grep
  • pandoc
  • pdftotext -layout
  • sed
  • unix2dos and dos2unix
  • wget
  • curl

R libraries

  • RCurl
  • XML
  • rvest
  • tm
  • xlsx

Python libraries

Vim tricks

  • buffer searches (:vim /pattern/ ##)
  • Ack plugin
  • bufdo (:bufdo %s/pattern/replace/ge | update)

Other tools


hpr2018 :: How to make Komboucha Tea

Released on 2016-04-27 under a CC-BY-SA license.

How to Make Kamboucha Tea

Makes about 1 gallon

Ingredients

Ingredient US Metric
water 3 1/2 quarts ??
white sugar 1 cup ??
black tea 8 bags (or 2 tablespoons loose tea) ??
starter tea from last batch of kombucha or store-bought 2 cups ??
scoby 1 per fermentation jar N/A

Optional flavoring extras for bottling: 1 to 2 cups chopped fruit, 2 to 3 cups fruit juice, 1 to 2 tablespoons flavored tea (like hibiscus or Earl Grey), 1/4 cup honey, 2 to 4 tablespoons fresh herbs or spices

Equipment

  • Stock pot
  • 1-gallon glass jar or two 2-quart glass jars
  • Bottles: Six 16-oz glass bottles with plastic lids, 6 swing-top bottles, or clean soda bottles

Instructions

Note: Avoid prolonged contact between the kombucha and metal both during and after brewing. This can affect the flavor of your kombucha and weaken the scoby over time.

1. Make the Tea Base: Bring the water to a boil. Remove from heat and stir in the sugar to dissolve. Drop in the tea and allow it to steep until the water has cooled. Depending on the size of your pot, this will take a few hours. You can speed up the cooling process by placing the pot in an ice bath.

2. Add the Starter Tea: Once the tea is cool, remove the tea bags or strain out the loose tea. Stir in the starter tea. (The starter tea makes the liquid acidic, which prevents unfriendly bacteria from taking up residence in the first few days of fermentation.)

3. Transfer to Jars and Add the Scoby: Pour the mixture into a 1-gallon glass jar (or divide between two 2-quart jars, in which case you'll need 2 scobys) and gently slide the scoby into the jar with clean hands. Cover the mouth of the jar with a few layers of cheesecloth or paper towels secured with a rubber band.

4. Ferment for 7 to 10 Days: Keep the jar at room temperature, out of direct sunlight, and where it won't get jostled. Ferment for 7 to 10 days, checking the kombucha and the scoby periodically.

It's not unusual for the scoby to float at the top, bottom, or even sideways. A new cream-colored layer of scoby should start forming on the surface of the kombucha within a few days. It usually attaches to the old scoby, but it's ok if they separate. You may also see brown stringy bits floating beneath the scoby, sediment collecting at the bottom, and bubbles collecting around the scoby. This is all normal and signs of healthy fermentation.

After seven days, begin tasting the kombucha daily by pouring a little out of the jar and into a cup. When it reaches a balance of sweetness and tartness that is pleasant to you, the kombucha is ready to bottle.

5. Remove the Scoby: Before proceeding, prepare and cool another pot of strong tea for your next batch of kombucha, as outlined above. With clean hands, gently lift the scoby out of the kombucha and set it on a clean plate. As you do, check it over and remove the bottom layer if the scoby is getting very thick.

6. Bottle the Finished Kombucha: Measure out your starter tea from this batch of kombucha and set it aside for the next batch. Pour the fermented kombucha (straining, if desired) into bottles, along with any juice, herbs, or fruit you may want to use as flavoring. Leave about a half inch of head room in each bottle. (Alternatively, infuse the kombucha with flavorings for a day or two in another jar covered with cheesecloth, strain, and then bottle. This makes a cleaner kombucha without "stuff" in it.)

7. Carbonate and Refrigerate the Finished Kombucha: Store the bottled kombucha at room-temperature out of direct sunlight and allow 1 to 3 days for the kombucha to carbonate. Until you get a feel for how quickly your kombucha carbonates, it's helpful to keep it in plastic bottles; the kombucha is carbonated when the bottles feel rock solid. Refrigerate to stop fermentation and carbonation, and then consume your kombucha within a month.

8. Make a Fresh Batch of Kombucha: Clean the jar being used for kombucha fermentation. Combine the starter tea from your last batch of kombucha with the fresh batch of sugary tea, and pour it into the fermentation jar. Slide the scoby on top, cover, and ferment for 7 to 10 days.

Additional Notes:

• Batch Size: To increase or decrease the amount of kombucha you make, maintain the basic ratio of 1 cup of sugar, 8 bags of tea, and 2 cups starter tea per gallon batch. One scoby will ferment any size batch, though larger batches may take longer.

• Putting Kombucha on Pause: If you'll be away for 3 weeks or less, just make a fresh batch and leave it on your counter. It will likely be too vinegary to drink by the time you get back, but the scoby will be fine. For longer breaks, store the scoby in a fresh batch of the tea base with starter tea in the fridge. Change out the tea for a fresh batch every 4 to 6 weeks.

• Other Tea Options: Black tea tends to be the easiest and most reliable for the scoby to ferment into kombucha, but once your scoby is going strong, you can try branching out into other kinds. Green tea, white tea, oolong tea, or a even mix of these make especially good kombucha. Herbal teas are ok, but be sure to use at least a few bags of black tea in the mix to make sure the scoby is getting all the nutrients it needs. Avoid any teas that contain oils, like earl grey or flavored teas.

• Avoid Prolonged Contact with Metal: Using metal utensils is generally fine, but avoid fermenting or bottling the kombucha in anything that brings them into contact with metal. Metals, especially reactive metals like aluminum, can give the kombucha a metallic flavor and weaken the scoby over time.

Troubleshooting Kombucha

• It is normal for the scoby to float on the top, bottom, or sideways in the jar. It is also normal for brown strings to form below the scoby or to collect on the bottom. If your scoby develops a hole, bumps, dried patches, darker brown patches, or clear jelly-like patches, it is still fine to use. Usually these are all indicative of changes in the environment of your kitchen and not a problem with the scoby itself.

• Kombucha will start off with a neutral aroma and then smell progressively more vinegary as brewing progresses. If it starts to smell cheesy, rotten, or otherwise unpleasant, this is a sign that something has gone wrong. If you see no signs of mold on the scoby, discard the liquid and begin again with fresh tea. If you do see signs of mold, discard both the scoby and the liquid and begin again with new ingredients.

• A scoby will last a very long time, but it's not indestructible. If the scoby becomes black, that is a sign that it has passed its lifespan. If it develops green or black mold, it is has become infected. In both of these cases, throw away the scoby and begin again.

• To prolong the life and maintain the health of your scoby, stick to the ratio of sugar, tea, starter tea, and water outlined in the recipe. You should also peel off the bottom (oldest) layer every few batches. This can be discarded, composted, used to start a new batch of kombucha, or given to a friend to start their own.

• If you're ever in doubt about whether there is a problem with your scoby, just continue brewing batches but discard the kombucha they make. If there's a problem, it will get worse over time and become very apparent. If it's just a natural aspect of the scoby, then it will stay consistent from batch to batch and the kombucha is fine for drinking.


hpr2003 :: Using the Incron file watching daemon

Released on 2016-04-06 under a CC-BY-SA license.

Using the Incron file watching daemon

Check out the man page for incron and also this write-up by Nixcraft.

basic usage:

incrontab -e

In your editor of choice, follow this syntax:

<path-to-watch> <event mask> command

Links


hpr1991 :: Adventures installing Linux on an Asus EeeBook X205A

Released on 2016-03-21 under a CC-BY-SA license.

High-level steps to install Ubuntu Mate on the Asus Eeebook X205A

Information compiled from Here, Here, and Here

Download and create startup disk

Download the 64-bit version of the iso, then create a bootable USB. I recommend using dcfldd.

Getting grub 32-bit

Compile or download grubia32.efi (see links), then move it into the /EFI/BOOT directory on the USB.

Installation

Boot from the disk (assuming you already disabled secure boot from the BIOS). Install the system as you like.

First Boot

Reboot, but leave in USB. Type c when grub loads, then enter in:

linux (hd1,gpt2)/boot/vmlinuz.... root=/dev/mmcblk0p2
initrd (hd1,gpt2)/boot/initrd....
boot

Wi-Fi

To get wi-fi working, put in terminal:

sudo cp /sys/firmware/efi/efivars/nvram-XXXXXX /lib/firmware/brcm/brcmfmac43340-sdio.txt

Then reload the brcmfmac driver:

sudo modprobe -r brcmfmac
sudo modprobe brcmfmac

Fix bootloader

Fix Bootloader with the following commands as root:

sudo apt-get install git bison libopts25 libselinux1-dev autogen m4 autoconf help2man libopts25-dev flex libfont-freetype-perl automake autotools-dev libfreetype6-dev texinfo

# from http://www.gnu.org/software/grub/grub-download.html
git clone git://git.savannah.gnu.org/grub.git

cd grub

./autogen.sh

./configure --with-platform=efi --target=i386 --program-prefix=""

make

cd grub-core
sudo su
../grub-install -d . --efi-directory /boot/efi/ --target=i386
cd /boot/efi/EFI
cp grub/grubia32.efi ubuntu/
exit

Then, we can just install grub-efi-ia32:

sudo apt-get update
sudo apt-get install grub-efi-ia32

Edit the grub configuration file:

sudo nano /etc/default/grub

Find the line starting GRUB_CMDLINE_LINUX_DEFAULT and add intel_idle.max_cstate=1 before quiet splash".

Then ctrl-o, ctrl-x to save & exit, and type: sudo update-grub to update Grub.

Remove the USB stick and reboot, and you should now have a self-sufficient booting system.

Conflict between sdhci-acpi and brcmfmac

Due to some conflict between sdhci-acpi and brcmfmac (https://bugzilla.kernel.org/show_bug.cgi?id=88061), a parameter has to be changed for the sdhci-acpi driver. There are several ways to do this, but a quick fix is to add this line in /etc/sysfs.conf (make sure you have the package sysfsutils installed), this way the option is passed before the brcmfmac driver is loaded :

# Disable SDHCI-ACPI for Wireless, otherwise WLAN doesn't work
bus/platform/drivers/sdhci-acpi/INT33BB:00/power/control = on

microSD Card Reader

Create a file /etc/modprobe.d/sdhci.conf with the following content:

# Adjustment to make micro SD card reader work
options sdhci debug_quirks=0x8000

Then run

update-initramfs -u -k all

After a reboot the card reader should be working.

Links


hpr1878 :: What's In My Bag

Released on 2015-10-14 under a CC-BY-SA license.

What's in My Bag Show Notes

Here are some links from the highlights of the episode


hpr1832 :: Simplify writing using markdown and pandoc

Released on 2015-08-11 under a CC-BY-SA license.

Show Notes

I write almost exclusively in Markdown http://daringfireball.net/projects/markdown when writing documents and taking notes. I use the program, Pandoc http://www.pandoc.org to convert markdown to different formats, including odt, docx, and pdf.

The original purpose of Markdown: 1 > Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).

Markdown has since been extended to include more features and functionality. Extended versions include Github-flavored markdown https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet and multi-markdown http://fletcherpenney.net/multimarkdown.

Some of the basic syntax:

  • Headings - use one or more # to make headings
  • bold - use __ or ** for bold
  • italics - use _ or * for italics
  • hyperlinks - use [text](link) for hyperlinks
  • images - `alternative text for images
  • tables - Head1 | Head2 | Head3 ---- | ------ | ----- stuff | stuff | stuff
  • lists - use - or * or + at the beginning of a line
  • quotes and code - ` for single code item, > for block quote, tab for block code, ``` for fenced code. Highlighting is available

Pandoc: 2 Pandoc can convert documents in markdown, reStructuredText, textile, HTML, DocBook, LaTeX, MediaWiki markup, TWiki markup, OPML, Emacs Org-Mode, Txt2Tags, Microsoft Word docx, EPUB, or Haddock markup to

  • HTML formats: XHTML, HTML5, and HTML slide shows using Slidy, reveal.js, Slideous, S5, or DZSlides.
  • Word processor formats: Microsoft Word docx, OpenOffice/LibreOffice ODT, OpenDocument XML
  • Ebooks: EPUB version 2 or 3, FictionBook2
  • Documentation formats: DocBook, GNU TexInfo, Groff man pages, Haddock markup
  • Page layout formats: InDesign ICML
  • Outline formats: OPML
  • TeX formats: LaTeX, ConTeXt, LaTeX Beamer slides
  • PDF via LaTeX
  • Lightweight markup formats: Markdown (including CommonMark), reStructuredText, AsciiDoc, MediaWiki markup, DokuWiki markup, Emacs Org-Mode, Textile
  • Custom formats: custom writers can be written in lua

I use Ubuntu because it is the only distro that does not bundle pandoc in the haskell libraries. With pandoc, you can specify the template that you are using, so that the same one document can be formatted quickly in many different ways and file formats.

Workflow:

  1. Write using vim or other text editor. When I was starting, I used a markdown previewer
  2. Create the template for the client
  3. Convert document appropriately

Use markdown for:

  • taking notes
  • creating SOPs
  • Creating User guides (Image Magick mogrify)
  • Creating things for my website

Other programs and tools:

  • Retext
  • Haroopad
  • discount
  • stackedit.io
  • atom
  • texlive for going direct to pdf

hpr1756 :: Ranger File Manager

Released on 2015-04-27 under a CC-BY-SA license.

From Man Page:

DESCRIPTION
ranger is a console file manager with VI key bindings. It provides a minimalistic and nice curses interface with a view on the directory hierarchy. The secondary task of ranger is to figure out which program you want to use to open your files with.

This manual mainly contains information on the usage of ranger. Refer to the README for install instructions and to doc/HACKING for development specific information. For configuration, see the files in ranger/config. They are usually installed to /etc/ranger/config and can be obtained with ranger's --copy-config option.

Inside ranger, you can press 1? for a list of key bindings, 2? for a list of commands and 3? for a list of settings.

  • Project page: http://ranger.nongnu.org/. Has pretty good documentation
  • Available on Debian, Arch, Probably others, git and mailing list available as well.

screenshot

Features

  • 3-pane view:
    • Previous -> current -> next
    • When current is a file, uses file magic and other programs to preview the file
    • optional dependencies for previews:
      • img2txt from caca-utils for ASCII-art
      • highlight for syntax highlights
      • atool for archives
      • lynx/w3m/elinks for html
      • pdftotext for pdfs
      • transmission-show for bittorrent information
      • mediainfo or exiftool for mediafile info
    • Color coded, with three themes to choose from
    • One more over to the right opens the file from other programs

Configuration

  • located in ~/.config/ranger directory
  • rc.conf = keybindings and settings
  • commands.py = command-mode items
  • rifle.conf = file launcher options, which let you make custom file opener commands
  • scope.sh = custom file preview scripts, like mdview
  • up, down, left, right, or h,j,k,l
  • gg top G Bottom
  • E edit
  • pageup/down

Command commands

  • spacebar to mark or :mark for pattern
  • dd, yy, pp
  • :touch, :mkdir, :grep
  • del
  • rename and bulkrename (change from ranger.container.file import File to .fsobject.)
  • zh - toggle hidden
  • gn - new tab, gt or gT to navigate tabs
  • / search vile
  • V visual mode
  • :open_with
  • 1? = list key bindings
  • 2? list commands
  • 3? list settings
  • ? main help

hpr1736 :: How I run my small business using Linux

Released on 2015-03-30 under a CC-BY-SA license.

Hardware

  • System76 Galago Ultrapro - Ubuntu 14.04
  • Synology DiskStation DS213j
  • LG G2

Proprietary Applications

  • Synology Cloud Station
  • Wireframe Sketcher

Free Applications

  • pandoc
  • discount -firefox
  • chromium
  • gvim
  • libreoffice
  • planner
  • hamster
  • todo.txt
  • gnucash
  • virtualbox
  • thunderbird
    • enigmail
    • stationary
  • california
  • ranger
  • L2TP/IPSEC vpn client
  • meld
  • deja-dup -> Box
  • Systemback
  • rsync

Links


Become a Correspondent