WeeChat perl plugin on SmartOS

Posted by Dave Eddy on 30 Mar 2015

Here's a quick hack to get the perl plugin working for WeeChat on the latest (2014Q4) SmartOS

weechat is now in pkgsrc, but it appears to have been built without perl support, which renders certain plugins not working with errors like:

/script install pushover.pl
script: script "pushover.pl" can not be installed because plugin "perl" is not loaded
/plugin load perl
Error: unable to load plugin "perl": ld.so.1: weechat: fatal: perl: open failed: No such file or directory
If you're trying to load a script and not a C plugin, try command to load scripts (/perl, /python, ...)


To quickly work around this:

1 install weechat from pkgsrc

pkgin in weechat

This will install weechat without the perl plugin

2 compile weechat at the same version from source

wget https://weechat.org/files/src/weechat-1.0.tar.gz
tar xzf weechat-1.0.tar.gz
cd weechat-1.0
mkdir build
cd build
cmake ../ -DPREFIX=/opt/local

THIS WILL FAIL, version 1.0 does not compile cleanly on SmartOS. However, perl.so has been built, which is all we need

3 move the plugin into place

sudo cp ./src/plugins/perl/perl.so /opt/local/lib/weechat/plugins/

4 it works

/plugin load perl will now work as expected


  1. have weechat in pkgsrc built with perl support
  2. fix weechat build problems on SmartOS - https://github.com/weechat/weechat/issues/381

Kodi/XBMC on Amazon Fire TV

Posted by Dave Eddy on 10 Dec 2014

These are some of the configs I'm using on my Amazon Fire TV to make XBMC / Kodi work on it without problems.


Add the following to advancedsettings.xml to eliminate sporadic buffering



Add this to dave.xml (or anything .xml) to get a sane keymap.

  • back button stops the current video
  • rewind and fast-forward work as expected
<?xml version="1.0" encoding="UTF-8"?>

Weekly Song Challenge

Posted by Dave Eddy on 07 Dec 2014

I've accepted a new challenge: every week for the next 52 weeks, I will compose, record and publish a new a song. I'll have a week to work on each song, and they will be "due" each Sunday for the next year.

To kick off the challenge (as today is Sunday) I have my latest song "The Guardian" on SoundCloud.

Album Release - Memories

Posted by Dave Eddy on 16 Jul 2014

Checkout my album Memories, released July 16th, 2014, on iTunes and BandCamp

This is the culmination of ~10 years of music composition and recording, and you can buy all 19 tracks (68 minutes of music) for only $10.

Red, Yellow, and Blue

Posted by Dave Eddy on 01 Jul 2014

Red, yellow, and blue are the primary colors... right?

RYB Color Wheel

A couple years ago, I was talking with Skye, and she was telling me how she was annoyed with color pickers on computers found in most image processing and manipulation software, and how she wanted to use a real color wheel or color picker.

I was confused. I've seen plenty of color pickers online, all showing the standard rainbow array of colors you are used to seeing with plenty of output formats like hex, rgb, hsl, etc. When I asked what she meant, that started me on a huge journey into color theory and how it relates to computers.

In school, I was taught the primary colors are red, yellow, and blue. With these colors, all other colors can be created by mixing them together. However, with monitors, TVs, projectors, etc., the colors that are used are red, green, and blue, typically referred to as RGB. Why is this different? How can you substitute out yellow for green and still get the same array of colors?


Human Readable Duration in Bash

Posted by Dave Eddy on 29 Jun 2014

show seconds in a human-readable form using pure bash

This function provides a simple way to turn a number of seconds into a human readable form using minutes, hours, days, etc. For example.

$ human 50
50 seconds
$ human 600
10 minutes
$ human 75890
21 hours
$ human 475890
5 days
$ echo "bash has been running for $(human "$SECONDS")"
bash has been running for 2 minutes

The Code

human() {
    local seconds=$1
    if ((seconds < 0)); then
        ((seconds *= -1))

    local times=(
    $((seconds / 60 / 60 / 24 / 365)) # years
    $((seconds / 60 / 60 / 24 / 30))  # months
    $((seconds / 60 / 60 / 24))       # days
    $((seconds / 60 / 60))            # hours
    $((seconds / 60))                 # minutes
    $((seconds))                      # seconds
    local names=(year month day hour minute second)

    local i j
    for ((i = 0; i < ${#names[@]}; i++)); do
        if ((${times[$i]} > 1)); then
            echo "${times[$i]} ${names[$i]}s"
        elif ((${times[$i]} == 1)); then
            echo "${times[$i]} ${names[$i]}"
    echo '0 seconds'

MIT License

Cross-Platform Implementation of which

Posted by Dave Eddy on 22 May 2014


find the path of a binary in your PATH using only bash

The tool which(1) has many different implementations on many different operating systems. Because of this, its output and return codes are not well-defined, and should not be trusted in the context of a script. However, it is often desirable to determine if an executable exists on a filesystem, without having to fork the executable itself to test.

The algorithm which(1) uses is fairly simple: loop over all paths found in the environmental variable PATH, and test for the existence, and executable bit, of the binary in question.

The function below will search your PATH for the binary name given as the first argument, and print the full path of the first binary found and return 0 if it is successful. Otherwise, it won't print anything, and will return 1.

binfind() {
    local paths path
    IFS=: read -a paths <<< "$PATH"
    for path in "${paths[@]}"; do
        if [[ -x $path ]]; then
            echo "$path"
            return 0
    return 1

Example usage

$ binfind echo
$ binfind clang
$ binfind foobar
$ echo $?

What's Open for iOS

Posted by Dave Eddy on 09 Nov 2013

Use What's Open to find places around you that are currently open

I just released What's Open for iOS this morning. Check it out for $1.99 in the App Store.

Open this app to see a map that automatically zooms to your current location and shows every place around you that is open - Complete with "food" and "pizza" buttons!

  • Find all places around you that are currently open
  • See how long you have until a business closes (ie. 30 minutes left!)
  • Search for keywords like "pasta", "Chinese", "bars", etc.
  • Easily open your favorite maps app for navigation
  • Quickly call any place you find
  • Share places found on Facebook and Twitter
  • Eat at new restaurants, visit new locations!
  • Great for finding late night spots

Directory Management with cd

Posted by Dave Eddy on 14 Sep 2013

You cd around like you normally would, and the directories are pushed into a stack. Use the function s to view the stack of directories, and run s "$num" to cd into the directory listed. Use b to jump back 1 directory.

I was inspired by this article written by Derek Wyatt about directory management in BASH. The code I've written for this accomplishes most of the same tasks, but does so with about 1/3 of the code, as this was written specifically for BASH (no legacy KSH bits) and doesn't implement any of the fancier features for cd.


In the above example I cd around a bit, and then run s to see what the current stack looks like. The current stacks shows all of my previous directories in reverse order (limited to $CD_STACK_MAX entries, which defaults to 15).

The code is on GitHub here https://github.com/bahamas10/bash-cdstack

What's Open Now?

Posted by Dave Eddy on 18 Jun 2013

You sit down to watch the LMN premier of Drew Peterson: Untouchable, when next thing you know, you just watched LMN for the last 6 hours, it is now 4am, and you're hungry. The obvious question is "What's open?", but where do you find the answer?

What's Open has the answer.

What's Open is a free service that uses Google Maps to show what places are around you are currently open.


Skye came up with the idea, and I wrote the code.

You can view the site here http://whatsopen.pw

As well as view the source code here https://github.com/bahamas10/whats-open

Newer Posts 1 of 12 Older Posts »