Skip to content

Instantly share code, notes, and snippets.

View njh's full-sized avatar

Nicholas Humfrey njh

View GitHub Profile
njh / rake-spec-all
Last active August 29, 2015 13:57
Run 'rake spec' for all the versions of ruby installed using rbenv
View rake-spec-all
for path in `rbenv root`"/versions/"*; do
if [ -d "$path" ] && [ ! -h "$path" ]; then
export RBENV_VERSION="${path##*/}"
echo "=== Running 'rake spec' for $RBENV_VERSION ==="
rm -f Gemfile.lock
rbenv exec bundle install --local
rbenv exec rake spec
echo && echo
View mosquitto_embedded_server_example.c
// Create a new server
mosq = mosquitto_server_new();
// Configure more stuff
mosquitto_server_set_opt(MOSQUITTO_SERVER_TLS, FALSE);
// Bind server to a socket
mosquitto_server_bind(mosq, 1883);
njh / 29138.php
Last active August 29, 2015 14:03
View 29138.php
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib/');
require_once "EasyRdf.php";
EasyRdf_Namespace::set('ont', '');
$graph = new EasyRdf_Graph();
$graph->parseFile('29138.ttl', 'turtle');
echo "<ul>\n";
njh / gist:52c3260ab7242c66b70a
Last active August 29, 2015 14:06 Townsend SEO
View gist:52c3260ab7242c66b70a
Subject: - Help Needed for Google Penalty. Please Remove Link(s)
Date: 2014-09-25 03:26
From: Townsend SEO Admin <>
To: "" <>


We wish to thank you for linking to our site from Unfortunately, it has come to our attention that this link is against Google's Webmaster Guidelines.

It is important for us to bring our site into compliance with Google's terms.

njh /
Last active August 29, 2015 14:10
Combine the Paho MQTT-SN Embedded-C sources in a single file
#!/usr/bin/env perl
# Script to combine the Paho MQTT-SN embedded-C library into a
# single source and header file
# Nicholas Humfrey
# Twitter: @njh
use strict;
njh / cisco_to_isc-dhcp-client-422.png
Last active August 29, 2015 14:15
DHCP Client and Server transaction comparision
njh / gist:385526
Created April 30, 2010 17:34
Ruby code to build a fake FOAF social network of 20 people and insert it into RedStore
View gist:385526
require 'rubygems'
require 'rdf'
require 'rdf/redstore'
require 'spira'
require 'faker'
class Person
include Spira::Resource
type RDF::FOAF.Person
View Spira Person example
#!/usr/bin/env ruby
require 'rubygems'
require 'spira'
require 'rdf'
include RDF
class Person
include Spira::Resource
njh / sinatra-linkeddata-example.rb
Created May 26, 2010 09:31
Example of using Sinatra and Spira with Rack::LinkedData for content negotiation.
View sinatra-linkeddata-example.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
require 'spira'
require 'rack/linkeddata'
use Rack::LinkedData::ContentNegotiation, :default => 'text/turtle'
include RDF
njh / rdfa-load
Created June 3, 2010 11:30
Example of parsing RDFa into a graph
View rdfa-load
#!/usr/bin/env ruby
require 'rubygems'
require 'rdf/rdfa'
graph = RDF::Graph.load('', :base_uri => '')
graph.each_statement do |statement|