local-npm with daemontools

Following the advice from Addy Osmani I set up local-npm on the caching proxy server. (So far, we're caching apt, pypi and now npm.)

These examples have URLs to a machine named 'donettes'. That is the cache. Adjust to your own network.

After setting up DNS, you need to install local-npm. The Ubuntu repo version of node is out of date, mainly because node is in flux, and the packages change. So download node from nodejs.org.

Rebuilding a Virtual Machine After Deleting It

This is a note to remind myself how to set up a new VM for development. This is a mess, not a tutorial.

This works on a target environment with this uname -a:

Linux marinela 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

My host system is set up to run a bunch of VirtualBox VMs. I have a VM network setup, and want to be able to throw away the VMs and start fresh, reconstructing them with an Ansible playbook.

devpi on Apache, with daemontools / supervise

I finally started putting my code into Python packages, and quickly found I needed a private repository. A little searching found devpi, a great caching proxy that's also a private repository.

My problem was that the configuration presented used nginx and supervised.

A Small Web Dev Network

This is a quick description of my current web dev network that includes a caching proxy server for Debian and Ubuntu packages, and Ansible.

Due to general annoyance with Ubuntu, I started using Debian again, but when I started learning Ansible to set up a staging server, I had to switch back, because Ansible plays nice with Ubuntu. It works with Debian but you need to build from sources.

So, start out by firing up VirtualBox and creating two machines (512M to 1G RAM, 8G disk). Into one, I loaded Debian, but any distro is fine. Debian is just smaller.

A Small Library to Change WordPress Options (useful for E2E WP Testing with Selenium)

I was messing with E2E testing of WordPress, and it was going okay, but I hit a wall when I needed to mess with one of the options, to turn of a CAPTCHA. You don't want to use deal with CAPTCHAs during a test, at least not every test. There may be some where you want to see the CAPTCHA.

The right way to do this is to flip options on and off.

Configuring Git to use Your SSH Keys

Github has instructions on how to do this.

Okay, you've done it, but it's still not working.

The problem I keep having is that I clone repos via HTTPS rather than git, so my settings need tweaking.

.git/config usually has a line like this:

[remote "origin"]
    url = https://github.com/johnkawakami/SitesForBernie.git
    fetch = +refs/heads/*:refs/remotes/origin/*

So, I need to change the URL, replacing the first part with "git@github.com:" I also like to add a setting for [push] to get rid of the long mes

Angular $q Promise Gotchas

This is here so you can laugh at the first mistake.

Gotcha: resolve(), not return:

Spot the bug:

$q(function(resolve, reject) {
    if (someVarInScope) {
        return someFunctionThatReturnsAPromise();
    } else {
        reject("some error message");

It's probably easy, given the headline. Line 3 is in error. It should be:


"return" exits the function.

Problems Injecting DOM Elements from Angular Views into D3 Objects

I was having a hell of a lot of gotchas related to redrawing a D3 chart within an Angular view. It was looking like something on the Angular side was causing my DOM references to break. Maybe ng-route redrawing views?

That was bad, because my charts were being appended to a DOM element that had been passed from Angular over into D3 via a config object. It worked before changing routes, but when you toggled through routes and returned to the chart, it couldn't be redrawn.

Javascript Method Chaining, aka Fluent Interface

There are several ways to implement the Fluent Interface in JS, and this is one I was using in a project, and halfway forgot.

Docker on VirtualBox installation commands

This is a short howto about setting up VirtualBox with a Docker environment in it.

Set up a clean Debian VM with the regular install, a 10G disk, and nothing but the SSH server packages. (I have started to just use the Vagrant setup, which uses the username vagrant and password vagrant, in case I want to convert it to a Vagrant image.) Download the VirtualBox Guest Additions CD and, as root, do these things to prep the virtual box to install the drivers.

Run the following.

March for Bernie

I have been working on March for Bernie on the side, for free of course. It's a WordPress site with a theme from Bernie volunteers.

Testing Angular Promises and the $http XHR Service with Jasmine

This is a rough note, because I finally figured this out after several hours of trying. If I'm wrong, please email me, and I'll fix it.

I had a problem because I wanted to centralize my $http requests in services rather than having XHR calls in controllers. My first attempts used callbacks, but I wanted to convert them to promises, which are a lot nicer. Thus, I had to test promises that used $http.

The TDD/BDD Religion, Getting The

I must admit that I'm fully drunk on the Kool-Ade.

The tl;dr : testing isn't just writing tests, but also using mock objects and services to simplify testing, and using package managers to port code to new versions of modules. It takes days to learn how, but it's worth it.

End the Chaos, Get with the Program: Python Logging to Syslog, and Filtering with RSyslog

This article describes how to use Python's logging library to send logs to syslog. Then, using rsyslog, a fancier syslog, we produce a log of pre-filtered output.

I have a process that runs a few times an hour, and it spits out results to STDOUT, which cron dutifully emails to me.

Search this Site from the Search Box

If you go to the home page you can add a site-limited google search to your search bar. Google isn't too nice about it, but it'll work.

Syndicate content