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

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


Correspondent

norrist

Host Image
Host ID: 342

email: norrist.nospam@nospam.gmail.com
episodes: 3

hpr2181 :: Install OpenBSD from Linux using Grub

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

Install OpenBSD from Linux using Grub

Why OpenBSD

Tune in for another episode.

Why install from linux

  • Most VPS providers have images for linux, but not OpenBSD
  • Easier than trying to upload custom image or iso.

Grub2

  • Start with a distro that uses grub2. I use Centos7
  • grub2 can load OpenBSD kernels.
  • The openbsd installer is a OpenBSD kernel.

Procedure

  1. Make sure you have console access to the linux VM
  2. Record the Network info for the running linux VM. If not using DHCP, you will need to know the IP, netmask, default route (gateway), and a DNS server.
  3. Download the OpenBSD installation ram disk to /boot

    cd /boot
    wget http://ftp5.usa.openbsd.org/pub/OpenBSD/6.0/amd64/bsd.rd
  4. Reboot
  5. Enter the grub command prompt by pressing c at the grub menu
  6. The grub2 prompt has tab completion which can be helpful.
  7. Type ls to see the available disks
  8. Load the OpenBSD installation ram disk and boot

    grub> set root=(hd0,msdos1)
    grub> kopenbsd /bsd.rd
    grub> boot

The Installation

  • The Installer will ask you several questions
  • The default is almost always what you want. If unsure, just press enter.
  • Look at the FAQ if you get stuck
  • Enter the network settings of the linux VPS
  • When asked "Location of sets", use HTTP

hpr2145 :: Daily notes and todo list with markdown

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

Using Markdown and git to store your todo list and daily journal

Why markdown
  • No distractions
  • Simple syntax
  • Plain text, Human readable.
  • Inline HTML
  • Easy conversion to other formats
Why git
  • Any SCM probably OK
  • Github and Gitlab render markdown.
The todo page
    # TODO

    ### Can do now
    * Bullet 1
    * Bullet 2

    ### Near term
    1. Numbered 1
    1. Numbered 2

    ### Long term
The journal script
    DAILYFILE="/Users/norrist/Projects/todo/daily/$(/bin/date +%F).md"
    DAILYPATH="/Users/norrist/Projects/todo/daily/"
    LOCKFILE="/Users/norrist/Projects/todo/daily/LOCK"
    TODOFILE="/Users/norrist/Projects/todo/todo.md"

    if [ -f $LOCKFILE ]
        then
            echo "$LOCKFILE PRESENT - ABORTING"
            read -n1 -p "Remove and Continue? [y,n]" doit
                case $doit in
                    y|Y) echo "Continuing with $LOCKFILE PRESENT" ;;
                    *) exit 1 ;;
                esac


        else
            echo "NO LOKCFILE"
            touch $LOCKFILE

    fi


    if [ -f $DAILYFILE ]
        then
            echo "$DAILYFILE exists"
        else
            echo  >> $DAILYFILE
            echo  "-----">> $DAILYFILE
            echo "# $(/bin/date +%F)" >> $DAILYFILE
            echo  >> $DAILYFILE
            echo "### Projects" >> $DAILYFILE
            echo  >> $DAILYFILE
            echo "### Tickets" >> $DAILYFILE
            echo  >> $DAILYFILE
            echo "### Walkups" >> $DAILYFILE
    fi

    /usr/local/bin/edit -w --new-window $DAILYFILE
    /opt/local/bin/aspell -c $DAILYFILE
    /opt/local/bin/aspell -c $TODOFILE

    rm $LOCKFILE
    rm $DAILYPATH/README.md

    cat $TODOFILE >> $DAILYPATH/README.md

    for f in $(ls  -r $DAILYPATH/2*md)
     do cat $f >> $DAILYPATH/README.md
     echo >>$DAILYPATH/README.md
     done

    cd /Users/norrist/Projects/todo; /usr/bin/git add . && /usr/bin/git commit -m "$(date)" && /usr/bin/git push origin master

Daily file template

    # 2016-08-02

    -----

    ### Projects

    ### Tickets

    ### Walkups
aspell is awesome

hpr2113 :: sqlite and bash

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

Crontab

0 3 * * 0 /bin/du -m /data/ > /home/USER/du_files/"du_$(/bin/date +\%Y\%m\%d)"

Script

cd ~/du_files
TODAYS_FILE="du_$(/usr/bin/date +%Y%m%d)"
YESTERDAYS_FILE="du_$(/usr/bin/date --date="7 days ago" +%Y%m%d)"
/usr/bin/echo "create table old (oldsize integer, path varchar);" > delta.sql
/usr/bin/echo "create table new (newsize integer, path varchar);" >> delta.sql
/usr/bin/echo '.separator "\t" ' >> delta.sql
/usr/bin/echo ".import $TODAYS_FILE new" >> delta.sql
/usr/bin/echo ".import $YESTERDAYS_FILE old" >> delta.sql
/usr/bin/echo ".mode csv" >> delta.sql
/usr/bin/echo ".headers on" >> delta.sql
/usr/bin/echo ".out deltas.csv" >> delta.sql
/usr/bin/echo "select *,newsize-oldsize as delta_in_megabytes from old natural join new where oldsize<newsize order by delta_in_megabytes desc;" >> delta.sql

/usr/bin/sqlite3 < delta.sql

echo $YESTERDAYS_FILE|/usr/bin/mailx -a deltas.csv -s deltas.csv me@mywork.com

Resulting SQL

create table old (oldsize integer, path varchar);
create table new (newsize integer, path varchar);
.separator "\t"
.import du_20160821 new
.import du_20160814 old
.mode csv
.headers on
.out deltas.csv
select *,newsize-oldsize as delta_in_megabytes
from old    natural join new    where oldsize<newsize
order by delta_in_megabytes desc;

Become a Correspondent