Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<param name="Threshold" value="INFO" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>
</layout>
@hugoduncan
hugoduncan / gist:1001548
Created June 1, 2011 00:26
debian squeeze preseed late_command for automated install of virtualbox guest additions
# Install virtualbox additions.
# Requires the guest additions iso connected to the secondary slave.
# This seems overly complicated, but is a combination
# that seems to work:
# the vbox ose packages were somehow being installed by the standard task,
# the LSB header is required for update-rc.d, which in turn is needed,
# due to straight linking to rc2.d not working (automatic boot sequence,
# and dependency management),
# cdrom source not being removed at the point when this script runs.
# Deletes /etc/udev/rules.d/70-persistent-net.rules to allow cloning.
@hugoduncan
hugoduncan / primitive_predicate.clj
Created April 11, 2021 13:30
Predicate for testing whether a value is primitive in clojure
(definterface IPrimitive
(is_primitive [^boolean x])
(is_primitive [^float x])
(is_primitive [^double x])
(is_primitive [^int x])
(is_primitive [^long x])
(is_primitive [^Object x]))
(deftype IsPrimitive []
IPrimitive

Keybase proof

I hereby claim:

  • I am hugoduncan on github.
  • I am hugoduncan (https://keybase.io/hugoduncan) on keybase.
  • I have a public key ASDseSq5a9GjSqrnIsEMf3Ga_qvOzbvm9uamhZD2yQ3nCgo

To claim this, I am signing this object:

Verifying my Blockstack ID is secured with the address 1MRCNmVgM2t3mryyaknMZagM9Rxdvs1v6K https://explorer.blockstack.org/address/1MRCNmVgM2t3mryyaknMZagM9Rxdvs1v6K
@hugoduncan
hugoduncan / list_view.clj
Last active February 7, 2016 04:03
Using a React Native ListView with om.next
(list-view
{:dataSource (clone-with-rows
data-source
(clj->js
(mapv #(assoc % :omcljs$meta (pr-str (meta %)))
objects)))
:renderRow (fn objects-render-r-row [row section-id row-id]
(let [row (j->c row)
m (:omcljs$meta row)
m (if m (reader/read-string m))
@hugoduncan
hugoduncan / gist:8611473
Created January 25, 2014 03:38
Scaling the Infrastructure Continuum

Scaling the Infrastructure Continuum

The choices of infrastructure is ever increasing - dedicated servers, VPS, cloud images, virtualisation and containers.

Each of these choices has advantages that suit a particular use case. A single application, when viewed from the development and operation perspective has many use cases however. Local virtualisation makes good sense for development. Ephemeral cloud nodes fit well for testing. Dedicated hardware is good choice for production in constant load environments. An image based solution is great

@hugoduncan
hugoduncan / gist:8611549
Created January 25, 2014 03:48
Criterium - reliable micro-benchmarks

Criterium - reliable micro-benchmarks

abstract

We’ve all timed a clojure function using clojure’s `time` macro, and then wondered why we don’t get stable results. We’ve seen Rich show off order of magnitude speed differences in new versions of clojure using the time macro. But what happens when you want reliable benchmarks, that can track small changes in timings? `time` falls short.

@hugoduncan
hugoduncan / Test.hs
Created January 12, 2014 15:25
An attempt to create a function that process an external representation of different data types
{-# LANGUAGE ScopedTypeVariables #-}
module Test () where
-- a type class to specify parsing and encoding of a type
-- (in reality I'm using hedn, which is similar to aeson)
class T a where
f :: String -> a
g :: a -> String
@hugoduncan
hugoduncan / gist:1377108
Created November 18, 2011 17:20
Alternate cache protocol
(ns pallet.cache.impl
"An implementation namespace for pallet.cache")
(defprotocol CacheProtocolImpl
"Cache implementation interface."
(lookup [cache e] [cache e default]
"Retrieve the value associated with `e` if it exists")
(has? [cache e]
"Checks if the cache contains a value associtaed with `e`"))