Skip to content

Instantly share code, notes, and snippets.

View davidglassborow's full-sized avatar

David Glassborow davidglassborow

View GitHub Profile
@davidglassborow
davidglassborow / index.md
Created October 27, 2015 18:18 — forked from johan/index.md
osx + java 7 = painfully easy

Step 1

Does your osx terminal speak java 7? Start Terminal.app and try: java -version:

> java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
@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
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
#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
@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'

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:

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.

# 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
#!/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 / 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',