John Piasetzki's Blog

My Thoughts

How to Write a Hacker News Comment

One of my goals for this year is to be more active on Hacker News in a positive way. I read through the guidelines and the top comments and came up with some observations on what make a good comment.

  • Make a point, even if you’re not disagreeing try to make it live up to DH6. Refuting the Central Point
  • Questions are rarely points therefore good commentors rarely ask questions (Never ask questions you can answer yourself)
  • Don’t beat a dead horse i.e. the older the story the better your comment has to be
  • Don’t write in first person
  • Be nice
  • Write enough to get the point across no more
  • Above all else, make it interesting

From these I came up with some habits to build:

  1. Ask myself (out loud where possible): What is the point of the comment and does it add to the discussion?
  2. Is the point I’m going to make important enough for the age of the post (it had better be a damn good point for anything older then 12 hours).
  3. Write the comment
  4. Run a timer for 5 mins Eggtimer and then check if I still want to say it.
  5. If I post something I come to regret (e.g. some of the comments on Programming prodigy passes away at 16), apologize.

I’ve also been considering listed my real name in my profile. Right now you could find it but it would take a little work.

Read This Book Not That One

The 4-Hour Workweek NOT Do More Faster

The 4-Hour Workweek is full of actionable stuff you can apply roboticly. It’s simple and structured so you can just follow the tips. Do More Faster on the other hand is short chapters around a theme. Similar advice but I found it a lot less actionable.

C Programming Language NOT The Art of Computer Programming

The Art of Computer Programming is the authority on algorithms. Looking in the relevant TACP is almost always worth while whenever your doing anything complicated. Reading them cover to cover is not (disclaimer I’ve only done this with one). I learned more (did more) when I brushed up on my C with C Programming Language.

For Whom the Bell Tolls NOT Harry Potter

Richard Feynman always talked about how his different set of mathimaticly tools gave him the edge. It’s the same way with books. If your chatting with someone and have a different sets of literary tools you both have far more to offer each other in terms of unique view points. Harry Pottery has outsold Hemingway around 10 to 1. For Whom the Bell Tolls is a great book that can start expanding your library.

Git Dotfiles Without the Bloat (Rake, Yadr, Make, Kitchen Sink!)

I finally got around to adding my dotfiles into git. All the methods I could find on github were too bloated for my liking (I don’t like to use build scripts for until necessary).

So I rolled my own (clone it on git). Super simple one line bash post-commit updates all my symbolic links. Every time something gets committed it symbolic links all the files in the .dotfile folder into your home directory.

find ~/.dotfiles/ -type f -name ".*" -exec ln -s -f {} 
    --target-directory=$HOME \;

Fork it, change it or tell me why I’m wrong!

Software RAID on OpenBSD Using Softraid

A step-by-step guide to installing softraid with OpenBSD

I found that there wasn’t a lot of documentation for how to install softraid (most of it still referenced RAIDframe). Here is my step by step guide to install softraid. This guide is very similiar to Installing OpenBSD 4.6 and references it at few points.

Follow the steps on getting OpenBSD boot up until it says:

(I)nstall, (U)pgrade or (S)hell? **S(RETURN)**

At this point we’re going to drop into a Shell to setup the raid disk first. You should end up with a prompt, where you are going to initialize the disks.

# cd /dev && sh /dev/MAKEDEV wd1 && cd /
# for i in wd0 wd1; do fdisk -yi $i; done
Writing MBR at offset 0.
Writing MBR at offset 0.
# disklabel -E wd0
Label editor (enter ? for help at any prompt
> a a
offset: [63] **(RETURN)**
size: [2097152] **(RETURN)**
FS type: [4.2BSD] **(RETURN)**
> a b
offset: [2097215] **(RETURN)**
size: [2598016] **(RETURN)**
FS type: [swap] **(RETURN)**
> a d
offset: [2097215] **(RETURN)**
size: [2097215] **(RETURN)**
FS type: [4.2BSD] **RAID(RETURN)**
> q
Write new label?: [y] **(RETURN)****disklabel wd0 > disklabel.wd1**
# **disklabel -R wd1 disklabel.wd1**

At this point your disklabels are properly setup and it’s now time to start the raid.

# **bioctl -C force -c 1 -l /dev/wd0d,/dev/wd1d softraid0**
# **dd if=/dev/zero of=/dev/rsd0c bs=1m count=1**

Now you have the raid all setup on sd0 and it’s time to get back to the installation.

# **exit**  
(I)nstall, (U)pgrade or (S)hell? **I(RETURN)**

Continue with the install as normal up until the disk setup section.

Available disks are: wd0 wd1 sd0.
Which one is the root disk? (or ‘done’) [wd0] **(RETURN)**
Disk: wd0       geometry: 121601/255/63 [1953525168 Sectors]
Offset: 0       Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 1: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
*3: A6      0   1   1 - 121600 254  63 [          63:  1953520002 ] OpenBSD
Use (W)hole disk, use the (O)penBSD area, or (E)dit the MBR? [OpenBSD] **W(return)**
Setting OpenBSD MBR partition to whole wd0…done.
OpenBSD area: 63-1953520065; size: 931.5G; free: 606.3G
#                size           offset  fstype [fsize bsize  cpg]
  a:             1.0G               63  4.2BSD   2048 16384    1 # /
  b:             1.2G          2097215    swap                   
  c:           931.5G                0  unused                   
  d:             4.0G          4695231  4.2BSD   2048 16384    1 # /tmp
  e:             6.0G         13083839  4.2BSD   2048 16384    1 # /var
  f:             2.0G         25619903  4.2BSD   2048 16384    1 # /usr
  g:             1.0G         29814207  4.2BSD   2048 16384    1 # /usr/X11R6
  h:             6.0G         31911359  4.2BSD   2048 16384    1 # /usr/local
  i:             2.0G         44494271  4.2BSD   2048 16384    1 # /usr/src
  j:             2.0G         48688575  4.2BSD   2048 16384    1 # /usr/obj
  k:           300.0G         52882879  4.2BSD   2048 16384    1 # /home
Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] **C(RETURN)**

You will now create an OpenBSD disklabel inside the OpenBSD MBR
partition. The disklabel defines how OpenBSD splits up the MBR partition
into OpenBSD partitions in which filesystems and swap space are created.
You must provide each filesystems mountpoint in this program.

The offsets used in the disklabel are ABSOLUTE, i.e. relative to the
start of the disk, NOT the start of the OpenBSD MBR partition.

Label editor (enter ? for help at any prompt)
> **m a**
offset: [63] **(RETURN)**
size: [2097152] **(RETURN)**
FS type: [4.2BSD] **(RETURN)**
mount point: [none] **/(RETURN)**
> **q**
No label changes.
Available disks are: sd0 wd1.
Which one do you wish to initialize? (or ‘done’) [done] **sd0(RETURN)**
MBR has invalid signature; not showing it.
Use (W)hole disk, use the (O)penBSD area, or (E)dit the MBR? [whole] **(return)**
Setting OpenBSD MBR partition to whole sd0...done.

You will now create an OpenBSD disklabel inside the OpenBSD MBR
partition. The disklabel defines how OpenBSD splits up the MBR partition
into OpenBSD partitions in which filesystems and swap space are created.
You must provide each filesystems mountpoint in this program.

The offsets used in the disklabel are ABSOLUTE, i.e. relative to the
start of the disk, NOT the start of the OpenBSD MBR partition.

Label editor (enter ? for help at any prompt)
> **A**
> **m a**
offset: [63] **(RETURN)**
size: [2097152] **(RETURN)**
FS type: [4.2BSD] **(RETURN)**
mount point: [/] **/altroot(RETURN)**
> **d b(RETURN)**
> **q**
Write new label?: [y] **(RETURN)**

From here just continue through the setup as normal. There are is one final step before rebooting. That is to copy whats on the first drive to the second:

dd if=/dev/wd0a of=/dev/wd1a

Reboot and make the second drive bootable.

/usr/mdec/installboot -v /mnt/boot /usr/mdec/biosboot wd1

Errata

  • The second drive does not have it’s root update with these instructions. I will update it when I figure out a fix.

Installing OpenBSD 4.6

A step-by-step guide to installing OpenBSD

I found that there was a lack of documentation on how to setup OpenBSD 4.6 with multiprocessor. After figuring it out on my own, I documented it as verbosely as possible.



First visit OpenBSD.org and download installation media from the closet mirror (alternatively OpenBSD can be installed by booting bsd.rd from an existing OpenBSD partition, or over the network using the PXE boot process). Select a mirror, navigate to 4.6 (or the most recent release), select your architecture, and download cd46.iso or floppy46.fs (the number 46 reflects the release version). The OpenBSD manual has a good faq on how to boot from the media on the 4.3 - Creating bootable OpenBSD install media page. Once you have the boot media done and have booted you’ll be presented with the following prompts.

Welcome to the OpenBSD/amd64 4.6 installation program.

(I)nstall, (U)pgrade or (S)hell? (return)**

**Cool! Let’s get to it.

At any prompt except password prompts you can escape to a shell by typing ‘!’. Default answers are shown in []’s and are sekected by pressing RETURN. You can exit this program at any time by pressing Control-C, but this can leave your system in an inconsistent state.

Choose your keyboard layout (‘?’ or ‘L’ for list) [default] (return)

System hostname? (short form e.g. ‘foo’) marisa(return)

I name my severs woman’s names like ships[1] for this one I picked the name Marisa.

Available network interfaces are: em0 vlan0.

Which one do you wish to configure? (or ‘done’) [em0] (return)

IPv4 address for em0? (or ‘dhcp’ or ‘none’) [dhcp] 192.168.1.29(return)

Netmask? [255.255.255.0] (return)

IPv6 address for em0? (or ‘rtsol’ or ‘none’) [none] (return)

Available network interfaces are: em0 vlan0.

Which one do you wish to configure? (or ‘done’) [done] **(return)

Default  IPv4 route? (IPv4 address, ‘dhcp’ or ‘none’) 192.168.1.1(return)
add net default: gateway 192.168.1.1
DNS domain name? (e.g. ‘bar.com’) [my.domain] 
123qc.no-ip.biz(return)

DNS nameservers? (IP address list or ‘none’) [none] 192.168.1.1(return)
Do you want to do any manual network configuration? [no] (return)**

This is all setup for my network. You should fill in info for your network.

In the next section I setup a user account. This isn’t required however is nice to have. I also set it up not to have X Window System.

Password for root account? (will not echo) ********(return)

Password for root account? (again) ********(return)

Start sshd(8) by default? [yes] (return)

Start ntpd(8) by default? [no] yes(return)

NTP server? (hostname or ‘default’) [default] (return)

Do you expect to run the X Window System? [yes] no(return)

Setup a user? (enter a lower-case loginname, or ‘no’) [no] jpiasetz(return)

Full user name for jpiasetz? [jpiasetz] John Piasetzki(return)

Password for jpiasetz account? (will not echo)  ********(return)

Password for jpiasetz account? (again)  ********(return)

Since you set up a user, disable sshd(8) logins to root? [yes] (return)

What timezone are you in? (‘?’ for list) [Canada/Eastern] (return)

Now it’s moving onto disk setup. I used the entire disk for OpenBSD.

Available disks are: wd0 wd1.

Which one is the root disk? (or ‘done’) [wd0] (return)

Disk: wd0       geometry: 121601/255/63 [1953525168 Sectors]

Offset: 0         Signature: 0xAA55

 Starting         Ending         LBA Info:

: id      C   H   S -      C   H   S [       start:        size ]


 0: 00      0   0   0 -      0   0   0 [           0:           0 ] unused

 1: 00      0   0   0 -      0   0   0 [           0:           0 ] unused

 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused

*3: A6      0   1   1 - 121600 254  63 [          63: 1953520002 ] OpenBSD
Use (W)hole disk, use the (O)penBSD area, or (E)dit the MBR? [OpenBSD] **W(return)

**Setting OpenBSD MBR partition to whole wd0…done.
The auto-allocated layout for wd0 is:

OpenBSD area: 63-1953520065; size: 931.5G; free: 606.3G

  #                size           offset  fstype [fsize bsize  cpg]

  a:             1.0G               63  4.2BSD   2048 16384    1 # /

  b:             1.2G          2097215    swap

  c:           931.5G                0  unused

  d:             4.0G          4695231  4.2BSD   2048 16384    1 # /tmp

  e:             6.0G         13083839  4.2BSD   2048 16384    1 # /var

  f:             2.0G         25619903  4.2BSD   2048 16384    1 # /usr

  g:             1.0G         29814207  4.2BSD   2048 16384    1 # /usr/X11R6

  h:             6.0G         31911359  4.2BSD   2048 16384    1 # /usr/local

  i:             2.0G         44494271  4.2BSD   2048 16384    1 # /usr/src

  j:             2.0G         48688575  4.2BSD   2048 16384    1 # /usr/obj

  k:           300.0G         52882879  4.2BSD   2048 16384    1 # /home

Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] A(return)

/dev/rwd0a: 1024.0MB in 2097152 sectors of 512 bytes

6 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each

Available disks are: wd1.

Which one do you wish to initialize? (or ‘done’) [done] (return)

I used the auto layout however you can customize it for your own needs at this point.

Lets install the sets!  
Location of sets? (disk ftp http or done) [ftp] (return)  
HTTP/FTP prox URL? (e.g. http://proxy:8080, or none) [none] **(return)**  
Server? (hostname, list#, done or ?) [ftp.OpenBSD.org] **(return)**  
Server directory? [pub/OpenBSD/4.6/amd64] **(return)**  
Login? [anonymous] **(return)**  

Select sets by entering a set name, a file name pattern or all. De-select sets by prepending a - to the set name, file name pattern or all. Selected sets are labelled [X].  
 [X] bsd  
 [X] bsd.rd  
 [X] bsd.mp  
 [X] base45.tgz  
 [X] etc45.tgz  
 [X] misc45.tgz  
 [X] comp45.tgz  
 [X] man45.tgz  
 [X] game45.tgz  
 [X] xbase45.tgz  
 [X] xetc45.tgz  
 [X] xshare45.tgz  
 [X] xfont45.tgz  
 [X] xserv45.tgz  
 Set name(s)? (or abort or done) [done] **-x*(return)**  
 [X] bsd  
 [X] bsd.rd  
 [X] bsd.mp  
 [X] base45.tgz  
 [X] etc45.tgz  
 [X] misc45.tgz  
 [X] comp45.tgz  
 [X] man45.tgz  
 [X] game45.tgz  
 [ ] xbase45.tgz  
 [ ] xetc45.tgz  
 [ ] xshare45.tgz  
 [ ] xfont45.tgz  
 Set name(s)? (or abort or done) [done] **-g*(return)**  
 [X] bsd  
 [X] bsd.rd  
 [X] bsd.mp  
 [X] base45.tgz  
 [X] etc45.tgz  
 [X] misc45.tgz  
 [X] comp45.tgz  
 [X] man45.tgz  
 [ ] game45.tgz  
 [ ] xbase45.tgz  
 [ ] xetc45.tgz  
 [ ] xshare45.tgz  
 [ ] xfont45.tgz  
 Set name(s)? (or abort or done) [done] **-bsd(return)**  
 [  ] bsd  
 [X] bsd.rd  
 [X] bsd.mp  
 [X] base45.tgz  
 [X] etc45.tgz  
 [X] misc45.tgz  
 [X] comp45.tgz  
 [X] man45.tgz  
 [  ] game45.tgz  
 [  ] xbase45.tgz  
 [  ] xetc45.tgz  
 [  ] xshare45.tgz  
 [  ] xfont45.tgz  
 Set name(s)? (or abort or done) [done] **(return)**  
Downloading sets  
Location of sets (disk ftp http or done) [ftp] **done(return)**  
Are you *SURE* your install is complete without bsd? [no] **yes(return)**  
Saving configuration files...done.  
Generating initial ost.random file...done.  
Making all device nodes...done.  
Multiprocessor machine; using bsd.mp instead of bsd.  

CONGRATULATIONS! Your OpenBSD install has been successfuly completed!  
To boot the new system, enter reboot at the command prompt.  
When you login to your new system the first time, please read your mail useing the "mail command.  

 # **reboot(return)**