Skip to content

Instantly share code, notes, and snippets.

View davidglassborow's full-sized avatar

David Glassborow davidglassborow

View GitHub Profile
# This method finds related articles using Jaccard index (optimized for PostgreSQL).
# More info: http://en.wikipedia.org/wiki/Jaccard_index
class Article < ActiveRecord::Base
def related(limit=10)
Article.find_by_sql(%Q{
SELECT
a.*,
( SELECT array_agg(t.name) FROM taggings tg, tags t

Friend-or-Foe Relations in the Middle East

Yesterday night, I stumbled upon yet another interesting graph:

middleeast

The "interactive" version of this image can be found on on this website: they basically try to interactively visualise the interplay of parties that are intervening in the many conflicts currently happening in the Middle East. It’s very, very well done.

So I did a little digging, and found that the original data is in a google doc that you can find over here. Look at the second tab: it’s basically an adjacency matrix of relationships between parties. In other words: a graph.

Steps to migrate from SVN to GitLab

This process worked for me. I take no responsibility for any damage or loss incurred as a result of following or not following these steps or, for that matter, anything else you might do or not do.

Setup

  • SVN is hosted at svn.domain.com.au.
  • SVN is accessible via http (other protocols should work).
  • GitLab is hosted at git.domain.com.au and:
@davidglassborow
davidglassborow / Gemfile
Last active August 29, 2015 14:14 — forked from ahaedike/Gemfile
source "https://rubygems.org"
gem 'eventmachine'
gem 'rubysl-stringio'
gem 'sinatra'
gem 'yajl-ruby', require: 'yajl'
gem 'thin'
gem 'em-websocket', :git=>'https://github.com/igrigorik/em-websocket.git'
#r "System.Xml.Linq"
open System
open System.IO
open System.Xml.Linq
let script = seq {
//TODO: this currently loads fsproj's in alphabeticall order, we should instead
//build the dependencies graph of the fsproj's and load them in topological sort order
This note explains how to build Postgres from source and setup to debug it using LLDB on a Mac. I used this technique to research this article:
http://patshaughnessy.net/2014/10/13/following-a-select-statement-through-postgres-internals
1. Shut down existing postgres if necessary - you don’t want to mess up your existing DB or work :)
$ ps aux | grep postgres
pat 456 0.0 0.0 2503812 828 ?? Ss Sun10AM 0:11.59 postgres: stats collector process
pat 455 0.0 0.0 2649692 2536 ?? Ss Sun10AM 0:05.00 postgres: autovacuum launcher process
pat 454 0.0 0.0 2640476 304 ?? Ss Sun10AM 0:00.74 postgres: wal writer process
pat 453 0.0 0.0 2640476 336 ?? Ss Sun10AM 0:00.76 postgres: writer process
@davidglassborow
davidglassborow / gist:915565
Created April 12, 2011 14:18
TORQUE-352: fix issue preventing Oracle driver working in Torquebox.org
class Java::java.sql::DriverManager
class << self
alias_method :get_connection_without_vfs, :getConnection
alias_method :register_driver_without_vfs, :registerDriver
# Monkey patch getConnection so we can sort out local filesystem url's for
# SQLite (we need to remove the 'vfs:' from the url)
def getConnection(url, *params)
# Remove any VFS prefix from the url (for SQLite)
@davidglassborow
davidglassborow / application.rb
Created October 16, 2011 14:35
Rails 3.1 Template for DataMapper 1.2.0.rc2
# This needs to be called after one of the gemfile templates
apply 'http://datamapper.org/templates/rails/config.rb'
apply 'http://datamapper.org/templates/rails/database.yml.rb'
inject_into_file 'app/controllers/application_controller.rb',
"require 'dm-rails/middleware/identity_map'\n",
:before => 'class ApplicationController'
inject_into_class 'app/controllers/application_controller.rb',
#!/bin/sh
#set -x
#
# chkconfig: 2345 99 01
# description: starts and stops torquebox
TORQUEBOX_JBOSS_USER=torquebox
if [ "$TORQUEBOX_JBOSS_USER" = "RUNASIS" ]; then
SUBIT=""
@davidglassborow
davidglassborow / AutoLayout.fs
Created October 12, 2015 19:01 — forked from praeclarum/AutoLayout.fs
AutoLayout wrapper to make creating constraints in F# easier
module Praeclarum.AutoLayout
open System
#if __IOS__
open Foundation
open UIKit
type NativeView = UIView
#else
open MonoMac.Foundation