Skip to content

Instantly share code, notes, and snippets.

View ajmcmiddlin's full-sized avatar

Andrew ajmcmiddlin

  • Brisbane, Australia
View GitHub Profile
@ajmcmiddlin
ajmcmiddlin / exercises.clj
Created March 24, 2013 09:41
Exercise solutions from the March 2013 Melbourne Clojure Workshop. Exercises taken from the first 5 Project Euler problems.
(ns clj-workshop.exercises)
(defn multiple-of
[n]
#(= 0 (mod % n)))
(defn ex1
[]
(let [multiple-of-3? (multiple-of 3)
multiple-of-5? (multiple-of 5)]
@ajmcmiddlin
ajmcmiddlin / dump-access-to-csv
Created July 16, 2015 23:43
Dump Access database to CSVs with mdbtools
#!/usr/bin/env bash
db="$1"
out_dir="$2"
tables="$(mdb-tables -1 "$db")"
echo "$tables" | while read t; do
mdb-export "$db" "$t" > "${out_dir}/${t}.csv"
done
#include <string>
#include <mapnik/map.hpp>
#include <mapnik/datasource_cache.hpp>
#include "vector_tile_processor.hpp"
#include "mvt_from_geojson.h"
struct _mvtc_return {
mvtc_return_code return_code;
std::string message;
@ajmcmiddlin
ajmcmiddlin / (Spac)emacs cheat sheet.md
Last active July 18, 2017 00:36
Stuff ajmccluskey needs to remember about (Spac)emacs

General

  • Space *: Search for word under cursor
  • Space t F toggles auto-fill-mode, which enables hard wrapping
  • C-x f calls set-fill-column - sets the column to wrap at
  • g q to format (applies wrapping if auto-fill-mode enabled)
  • Space s c clears search term
  • * e edit word under cursor and change all in file/display (depending on mode)
  • Space f y echo and yank filename for current buffer
@ajmcmiddlin
ajmcmiddlin / gis-notes.md
Last active February 14, 2017 01:08
Notes from GIS/web mapping research
#!/usr/bin/env stack
-- stack --install-ghc runghc --package hasql
{-# LANGUAGE OverloadedStrings #-}
import Data.Monoid ((<>))
import Hasql.Connection (acquire, release, settings)
import Hasql.Decoders (int8, singleRow, value)
import Hasql.Encoders (unit)
import Hasql.Query (statement)
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@ajmcmiddlin
ajmcmiddlin / ubuntu-ova-fixes.md
Last active September 13, 2017 07:04
Fixes required for a portable OVA made from an Ubuntu Vagrant box.

Fixing Ubuntu OVAs made with Vagrant

Context

We have a Vagrantfile in fp-course for creating an Ubuntu environment with course prerequisites available. If you export an appliance (OVA) from the resultant VM, it will have issues when you import it on other machines.

Symptoms

@ajmcmiddlin
ajmcmiddlin / unlock-dell-u2711.md
Created October 11, 2017 21:37
Unlocking the Dell U2711

The Dell U2711 on screen display (OSD) can be locked - I think by holding the button immediately above the power button (referred to as button 5 in some places). In my case I locked it totally by accident, and without realising what I'd done.

Unlocking the OSD proved quite the production. I found a [forum post] that contained most of the answer. I'll repeat the useful bit below:

  • Switch the monitor off
  • Disconnect all monitor cabling from the PC (VGA, DVI, HDMI, DP, USB, etc.)
  • Disconnect the monitor power cord from the rear of the monitor
  • Press and hold the monitor power button in for 5 seconds
#!/usr/bin/env ruby
BOARD_SIZE = 3
CELLS = BOARD_SIZE ** 2
MAGIC_SUM = 15
MAGIC_SQUARE = [8,1,6,3,5,7,4,9,2]
SYMBOLS = [:naught, :cross]
Game = Struct.new(:board, :next_symbol, :winner)