Chris Weyl

Chris Weyl's Technical Blog

This is my blog, my words; it is not my employer's.

Conditional Git Configuration

git has always(?) allowed for additional configuration files to be unconditionally included. However, sometimes on our systems we also have certain locations where we store multiple git projects, which may need different configuration from the global, but still common across that location.

Fast Project Finding With Fzf

fzf is a fantastic utility, written by an author with a history of writing useful things. He’s also a vim user, and in addition to his other vim plugins he has created an “enhancement” plugin called fzf.vim.

One of the neat things fzf.vim does is make it easy to create new commands for fuzzy searches. If you’re like me, you probably have some absurd number of project repositories you keep around and jump to, as necessary. Not everything is in the same directory (e.g. ~/work/), naturally, and with a laptop, desktop, and a couple other machines the less-frequently used repos may be where one least expects them to be — or not present at all.

No, Use *My* DNS. (Aka Netflix vs Tunnelbroker.net)

Google DNS is being hardcoded into a significant number of devices now. Which is nice, because it pretty much always works.

…except when you’re trying to use Netflix and you have a tunnelbroker IPv6 tunnel. Ugh.

So, this is a brief followup to Stupid OpenWRT tricks. Or maybe “Getting Netflix to work when your ISP doesn’t support IPv6 yet” is a better way to put it…

Stupid OpenWRT Ipv6 Tricks

So, if you’re like me you find yourself wondering why your broadband provider has a /32 IPv6 prefix assigned, and yet chooses not to use it, forcing one to either be IPv4-only (how 20’th century) or use an IPv6-over-IPv4 tunnel solution.

Fortunately there is a simple and free solution out there, courtesy of Hurricane Electric’s rather fabulous tunnelbroker service. Obtaining an IPv6 prefix and setting up the tunnel is covered, extensively, so I won’t go into it. It’s also rather easy to set the tunnel up on an OpenWRT based router, like mine. The default setup is rather nice, but there are some changes you can make to your router configuration that will make it even nicer.

Currying Patterns

One of the most dangerous books I’ve ever even partially read is MJD’s Higher Order Perl. In particular, its description of subroutine currying – that is, building more specific functions out of more general purpose ones – is a pattern I find incredibly useful.

The other day I found myself writing a number of routines that were surprisingly similar… kinda. They all implemented a common pattern, but across routines that were rather… different. I found myself wistfully longing for the familiar pattern of currying, and then realized – I’m working in PERL, DAMNIT.

MX::AttributeShortcuts -- Now With Moo-Style Type Constraints

I just released MooseX::AttributeShortcuts 0.028; it incorporates Moo-style type constraints.

…largely because I needed to relax, and wrote MooseX::Meta::TypeConstraint::Mooish :)

That means you can now pass a coderef to has() in isa that, like with Moo, dies on validation failure and lives on validation success:

1
2
3
4
5
6
7
8
# easiest is via AttributeShortcuts
use MooseX::AttributeShortcuts 0.028;

has foo => (
  is => 'rw',
  # $_[0] == the value to be validated
  isa => sub { die unless $_[0] == 5 },
);
0%