Compiling cpuminer on a RaspberryPi

I just spent the last bit compiling cpuminer on the RaspberryPi, and here’s my notes:

  1. sudo apt-get install automake libcurl4-openssl-dev libssl-dev
  2. ./configure
  3. Edit the compat/jansson/makefile and switch ar and ranlib to gcc-ar and gcc-ranlib
  4. make
  5. strip cpuminer

 

Market Cap is a strange beast

To paraphrase a great sword fighter, “I don’t think it means what I think it means.”

Consider the following thought experiment:

Imagine a stock that issued 100 shares for $100 each 100 years ago. No one then buys or sells for 100 years. The market cap for the last 100 years works out to $10,000 (100×100).

Today someone sells 1 share for $1,000,000.  Suddenly, the market cap is automatically calculated as, $100,000,000. Even though the real amount of money invested is only: $1,009,900.

Now if you could “prove” that there were 99 other people foolish enough to spend $1m per share, the market cap makes sense. But I don’t think we can say that a priori.

If we computed prices as the average of the last n shares bought (where n is the number of shares outstanding). I think we’d have a clearer picture of value.

In the above example, we would say that resulting market cap was only: 1,009,900, and therefore the correct price per share is: 1,009,900/100 = 10,099.  Which seems like a much more defensible position in terms of pricing.

Is DIY-BIO the Personal Computing of the 21st Century?

Bento Lab Starter KitLast last year I ran across the following article in IEEE Spectrum: Tools for Would-Be Biohackers.  Since I have a daughter with interests in Biology, I considered getting her one of these “mini-labs” as a Christmas gift.  The high cost had me wondering if this was an outrageous idea.  It works out that adjusting for inflation, these mini-labs aren’t any more expensive than 8-bit home computers of my youth.  My wife asked what seemed like a totally reasonable question, “What are they even good for?”  It’s a good question, and it was probably the same question my parents asked about those early personal computers.  It got me thinking about whether this kind of Do-It-Yourself home biology (actually genetics) is going to become the same kind of technological revolution that the personal computer became?

I don’t have a ready answer.  I do know that I’m not willing to dismiss the idea out-of-hand, and I want to learn more.  While I think the kits above are really cool from a technological perspective, I’m planning on doing some small scale (i.e. cheaper) things first.  It will be interesting to see if I can find an answer to my wife’s original question, and if there is a whole new world of innovation to come.

Here are links to the various mini-labs:

Getting FreeBSD 11 working on my Asus Zenbook UX31A

Sigh… not sure why this was so painful. After years away, I thought it would be nice to re-visit FreeBSD on my dedicated malware analysis laptop. While I had used FreeBSD for over a decade on personal server systems, I’ve never really used it as a desktop system, but I’m tired of the Linux disto situation. Besides, I’ve always been more comfortable on BSD-based systems.

But let’s face it, some Linux distros are much better at working as desktop systems. Here’s my (on-going) work to get FreeBSD 11.0RC2 going on my spare ultrabook.

During install make sure to configure the internal drive as GPT partition table and be sure the EFI partition is listed first.

After the install, enter the firmware to create “a new boot option” and indicate the location of the proper UEFI boot file.

Add boot option: Internal SSD
Select Filesystem: [accept default]
Path for boot option: \efi\boot\bootx64.efi

Form here, I’m basically just going to follow the FreeBSD desktop install instructions from CoolTrainer: https://cooltrainer.org/a-freebsd-desktop-howto/

Next swap CapsLock and Ctrl keys, because that’s just better:

echo 'keymap="us.ctrl" >> /etc/rc.conf

Then go into the System->Preferences->Hardware->Keyboard->Layouts and select “swap ctrl and caps lock”.

 

Some additional things I had to do:

  • installed emacs (text editor)
  • installed redshift (like flux)
  • installed slim (login manager)
  • installed cairo-dock (like Mac OS X dock)
  • installed cairn-dock-plugins
  • installed launch (like Alfred/Quicksilver)
  • installed compton (compositing window manager)
  • installed Chromium

Things I still need to work out:

  • Removable Media
  • SD card
  • Touchpad
  • WiFi panel for Gnome
  • Gnome 2/Mate sound

Installing the Nix Package Manager

There isn’t really a reason to read my install directions for nix, I just used the default install command for Linux/Mac OS X.  To wit:

curl https://nixos.org/nix/install | sh

Except that I had to modify the .profile script to work in tcsh.  Namely, I created a version of the default nix.sh file works for csh/tcsh:

#!/bin/sh

if [ -n "$HOME" ]; then
  NIX_LINK="$HOME/.nix-profile"
  echo 'setenv NIX_LINK $HOME/.nix-profile;'

  # Set the default profile.
  if ! [ -L "$NIX_LINK" ]; then
    echo "creating $NIX_LINK" >&2
    _NIX_DEF_LINK=/nix/var/nix/profiles/default
    /nix/store/rznhi2hyzcgckk7yb2662lr57sb906ps-coreutils-8.24/bin/ln -s "$_NIX_DEF_LINK" "$NIX_LINK"
  fi

  echo "setenv PATH ${NIX_LINK}/bin:${NIX_LINK}/sbin:$PATH;"
	
  # Subscribe the user to the Nixpkgs channel by default.
  if [ ! -e $HOME/.nix-channels ]; then
    echo "https://nixos.org/channels/nixpkgs-unstable nixpkgs" > "$HOME/.nix-channels"
  fi

  # Append ~/.nix-defexpr/channels/nixpkgs to $NIX_PATH so that
  #  paths work when the user has fetched the Nixpkgs
  # channel.
  echo "setenv NIX_PATH ${NIX_PATH:+$NIX_PATH:}nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs;"

  # Set $SSL_CERT_FILE so that Nixpkgs applications like curl work.
  if [ -e /etc/ssl/certs/ca-certificates.crt ]; then # NixOS, Ubuntu, Debian, Gentoo, Arch
    echo 'setenv SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt;'
  elif [ -e /etc/ssl/certs/ca-bundle.crt ]; then # Old NixOS
    echo 'setenv SSL_CERT_FILE /etc/ssl/certs/ca-bundle.crt;'
  elif [ -e /etc/pki/tls/certs/ca-bundle.crt ]; then # Fedora, CentOS
    echo 'setenv SSL_CERT_FILE /etc/pki/tls/certs/ca-bundle.crt;'
  elif [ -e "$NIX_LINK/etc/ssl/certs/ca-bundle.crt" ]; then # fall back to cacert in Nix profile
    echo 'setenv SSL_CERT_FILE "$NIX_LINK/etc/ssl/certs/ca-bundle.crt";'
  elif [ -e "$NIX_LINK/etc/ca-bundle.crt" ]; then # old cacert in Nix profile
    echo 'setenv SSL_CERT_FILE "$NIX_LINK/etc/ca-bundle.crt";'
  fi
fi

I installed this file as: /nix/var/nix/profiles/default/etc/profile.d/nix.csh. Then I just called in my .tcshrc using:

eval `/nix/var/nix/profiles/default/etc/profile.d/nix.csh`

BasicTeX 2015

Ok, this is part of the regular series of these posts, and mostly serve as a simple record for my own use.  If there’s anyone out there reading this, please disregard yet another TeX upgrade  posting.

I know I’m going to have to do this again in a week or so when BasicTeX 2016 hits, but here it is anyway.  I should have done the normal tlmgr uninstall in step 1, but I noticed that I had a backlog of old TeX install directories out there, so I nuked them instead.  Partly this is because El Capitan broke the TeX link (/usr/texbin) and some GUI utils weren’t working (mainly the PrefPane).

  1. create a list of installed packages: tlmgr info --only-installed | cut -d: -f1 | cut -c3- > tex-packages
  2. rm -rf /usr/local/texlive
  3. download and install the current BasicTeX package from tug.org
  4. tlmgr update --self
  5. tlmgr update --all
  6. create a list of the packages installed by default: tlmgr info --only-installed | cut -d: -f1 | cut -c3- > tex-default
  7. Diff the two lists: diff tex-default tex-packages
  8. Install the packages using tlmgr
  9. tlmgr install algorithms collection-fontsrecommended enumitem endnotes exam footmisc lastpage multirow paralist parnotes subfigure tex4ht titles todonotes
    

QNAP 451+: Hardware Accelerated Transcoding

I’m having problems with Plex using too much CPU to transcode files. Actually, I’m not sure why it’s transcoding to an AppleTV 4, it should be able to Direct Stream .mkv files. I’m trying to go ahead and use the QNAP hardware accelerated transcoding engine.

First problem, all transcode requests are returning, “Failed: File read/ write error“. No logs for the failure, so off to ssh I go. The transcode command lives in: /mnt/ext/opt/medialibrary/bin. There are three commands we care about:

  • mfytranscodesvr
  • mytranscodecmd
  • myvatranscode

Running the first seems to indicate it already running, and the second seems to kick-off another failing transcode. The third command is interesting because it appears to the be accelerated version. It’s actually a symbolic link to: /mnt/ext/opt/QDMS/bin/myvatranscode.

A quick check shows that the entire /mnt/ext/opt/QDMS directory is missing. This is apparently because I turned off DLNA streaming. By re-activating the “Media Streaming Add-on”, the accelerated streaming appears to be working now.

We’ll have to see if Plex is smart enough to pick-up the transcoded version when available.