Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am scottlowe on github.
  • I am scottlowe (https://keybase.io/scottlowe) on keybase.
  • I have a public key ASDmb7xiKJx5NtXBSQj-vkI7ltEVbh3l9PLSo_H8hnfefAo

To claim this, I am signing this object:

@scottlowe
scottlowe / cast_string_variable.sparql
Created November 14, 2017 21:38
SPARQL syntax for casting a variable (with a string in it) to a literal type
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ospc: <http://data.ordnancesurvey.co.uk/ontology/postcode/>
PREFIX geopos: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX geosparql: <http://www.opengis.net/ont/geosparql>
CONSTRUCT {
?postcode geosparql:hasGeometry [
a geosparql:Geometry ;
geosparql:asWKT ?wktlit ;
]
}
@scottlowe
scottlowe / reframe_event_console.js
Created November 14, 2017 16:10
Dispatch re-frame event "foo" with args "bar" from the JS console
var eventArgs = [new cljs.core.Keyword("foo"), "bar"]
var evt = new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, eventArgs)
re_frame.core.dispatch(evt);
@scottlowe
scottlowe / nexus-check.clj
Created November 27, 2012 19:55
A REPL tool to help Clojurians bag a Nexus
; Clojure is your friend and it will help you bag that Nexus you wanted.
; Paste into your REPL, sit back and wait in comfort. Checks every 60 seconds.
(import 'java.util.Date)
(import 'java.util.concurrent.Executors)
(import 'java.util.concurrent.TimeUnit)
(use 'clojure.java.browse)
(def nexus-page "https://play.google.com/store/devices/details?id=nexus_4_16gb")
@scottlowe
scottlowe / rvm.md
Created June 30, 2012 11:58
Install Ruby on Rails on Ubuntu 12.04 LTS

You will need curl. If you don't have it, install it via apt-get.

Now use curl to download and execute the latest RVM shell script:

curl -L get.rvm.io | bash -s stable

source /etc/profile.d/rvm.sh

(def axial-tree-a {:start [\F]
:rules {\F "F[+F]F[-F]F"}
:angle 25.7
:constants #{\F \+ \- \[ \]}
:cmd-map {\F :forward
\+ :left
\- :right
\[ :push
\] :pop}})
@scottlowe
scottlowe / euler-3.clj
Created January 18, 2012 00:52
Project Euler problem 3
(defn next-factor [target candidate]
(if (= 0 (mod target candidate))
candidate
(recur target (inc candidate))))
(defn largest-factor [n]
(loop [primes [(next-factor n 2)]]
(if (= n (reduce * primes))
(last primes)
(recur (conj primes (next-factor n (inc (last primes))))))))
@scottlowe
scottlowe / OpenSslAes.cs
Created November 30, 2011 23:38
OpenSSL AES CBC 256 in .NET for interop with Ruby
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace dotnet_aes
{
public class OpenSslAes
{
@scottlowe
scottlowe / etc_init.d_unicorn_example.co.uk
Created October 21, 2011 10:48
Ruby on Rails server setup on Ubuntu 11.04 with Nginx, Unicorn, Rbenv
#! /bin/bash
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn web server
# Description: starts unicorn
@scottlowe
scottlowe / Kernigan.txt
Created August 12, 2011 10:41
Programming quote of the day
“Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by definition,
not smart enough to debug it.”
Brian Kernighan