Hey, this is my blog

It is somewhat abandoned.

Git Custom Merge Drivers

Git merge drivers.

Read more...

Postgres Update With Join

How to perform and update with a join using CTE’s in postgres

  • in a cte, write a select that returns the update to values, and the join on conditions
  • join on that in the update
  • Test: Optionally write a select that tests your results and wrap it all in a rolled back transaction to test run
Read more...

Using Custom Packages in NixOs Configuration File

Here is a problem we encountered with NixOS:

The nix-channel we were on didn’t have the latest version of something we needed. This happened recently when my coworker upgraded to Postgres 9.5 from 9.4 but the PostGIS version in nixpkgs hadn’t been updated to a 9.5 compatible version.

Read more...

Bitcoin Transactions

What will be the average number of Bitcoin transactions per day in the first week of June 2016?

Read more...

Fitness Books

I’ve read a lot of fitness biographies over the last little while. Here is a quick list.

Read more...

More Scala Groups And Tuples

Continuing from here, I have lists of tuples and I want to group them. Here I have a list of 4-tuples and I want to group the second tuple by the first. The fact that I need to do this probably represents some greater problem, but that is a story for another time

import shapeless._
import syntax.std.tuple._
import poly._

object GroupLists {
def group1TwoExtra[A,B,C,D](t : List[(A,B,C,D)]) : List[(A,List[B],C,D)] = {
      val map = LinkedHashMap[A, LinkedHashSet[B]]()
      val mapOther = scala.collection.mutable.Map[A,(C,D)]()
      for (i <- t) {
        val key = i.head
        map(key) = map.lift(key).getOrElse(LinkedHashSet[B]()) + i.drop(1).head
        mapOther += (key -> i.drop(2))
      }
      map.map(b => (b._1, b._2.toList) ++ mapOther(b._1)).toList
    }
Read more...

Mixed Metaphors

Here I’m collecting some mixed metaphors that I thought were funny. Hopefully for use in a presentation about comedy I am doing

  • I wouldn’t eat that with a ten foot pole
Read more...

Scala Slick Group

In slick, if each foo has many bars and I need to retrive several foos and associtated bars I will do something like this:

val join = for {
     (f,b) <-
                  foo.filter(...) on  innerJoin
                  bar on (...)
   } yield (o,i,s)
Read more...

Hakyll and CircleCi

This blog was on tumblr, which was easy to setup and post and such. However, I spend like 8 hours a day with a text editor open and a git in terminal window.

Read more...

Lazy Evaluation In Haskell

This post is a work in progress and represents my getting to understand how laziness works in haskell and how it affects performance.

Read more...

Tags