Skip to content

Instantly share code, notes, and snippets.

View njh's full-sized avatar

Nicholas Humfrey njh

View GitHub Profile
@njh
njh / rake-spec-all
Last active August 29, 2015 13:57
Run 'rake spec' for all the versions of ruby installed using rbenv
#!/bin/bash
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
// 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
njh / 29138.php
Last active August 29, 2015 14:03
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib/');
require_once "EasyRdf.php";
EasyRdf_Namespace::set('ont', 'http://www.semanticweb.org/augunipov/ontologies/m_ontology#');
$graph = new EasyRdf_Graph();
$graph->parseFile('29138.ttl', 'turtle');
echo "<ul>\n";
@njh
njh / gist:52c3260ab7242c66b70a
Last active August 29, 2015 14:06
dbpedialite.org Townsend SEO
Subject: dbpedialite.org - Help Needed for Google Penalty. Please Remove Link(s)
Date: 2014-09-25 03:26
From: Townsend SEO Admin <seo.admin@townsendassets.com>
To: "dbpedialite.org@proxy.dreamhost.com" <dbpedialite.org@proxy.dreamhost.com>

Hello,

We wish to thank you for linking to our site townsendassets.com from 24-7pressrelease.com. 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
njh / combine-mqttsn-sources.pl
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
njh / cisco_to_isc-dhcp-client-422.png
Last active August 29, 2015 14:15
DHCP Client and Server transaction comparision
cisco_to_isc-dhcp-client-422.png
@njh
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
require 'rubygems'
require 'rdf'
require 'rdf/redstore'
require 'spira'
require 'faker'
class Person
include Spira::Resource
type RDF::FOAF.Person
#!/usr/bin/env ruby
require 'rubygems'
require 'spira'
require 'rdf'
include RDF
class Person
include Spira::Resource
@njh
njh / sinatra-linkeddata-example.rb
Created May 26, 2010 09:31
Example of using Sinatra and Spira with Rack::LinkedData for content negotiation.
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
require 'spira'
require 'rack/linkeddata'
use Rack::LinkedData::ContentNegotiation, :default => 'text/turtle'
include RDF
@njh
njh / rdfa-load
Created June 3, 2010 11:30
Example of parsing RDFa into a graph
#!/usr/bin/env ruby
require 'rubygems'
require 'rdf/rdfa'
graph = RDF::Graph.load('http://rdfa.digitalbazaar.com/test-suite/test-cases/xhtml1/0001.xhtml', :base_uri => 'http://rdfa.digitalbazaar.com/test-suite/test-cases/xhtml1/0001.xhtml')
graph.each_statement do |statement|
statement.inspect!
end