Skip to content

Instantly share code, notes, and snippets.

@shooley
shooley / gist:24e869265738e3fa98656eae1b7a9669
Created October 13, 2018 17:10 — forked from zenhob/gist:f70bbb802e3e6729a1a6
Bulding Go binaries for Raspberry Pi

To build a binary that will run on the Raspberry Pi, you need to have a Go cross compiler and enable it when building the executable.

To build the cross compiler for Linux/ARM (you only need to do this once):

cd /usr/local/go/src
sudo GOOS=linux GOARCH=arm ./make.bash --no-clean

Once you've done that, you can build a binary for Raspberry Pi:

@shooley
shooley / gist:06af824ce8da9d71bbfc
Last active August 29, 2015 14:10
Mergesort in Swift
let numbers = [9,29, 83, 19, 48, 65, 25, 30, 18, 1, 15, 84, 72, 63, 71]
func splitToSublists(list: [Int]) -> ([Int], [Int]) {
assert(list.count > 1, "List size must be greater than 1 before split")
let midIndex = (list.count / 2) as Int
if(list.count == 2) {
var leftSublist = Array([list[0]])
var rightSublist = Array([list[1]])
return (leftSublist, rightSublist)

Resources

Campaign Links

Campaign Links are links to external sites and are displayed as images.

Resource Description
GET campaign_links Returns a list of campaign links currently featured in the Global Navigation
@shooley
shooley / gist:8570732
Created January 23, 2014 00:55
Redis Helper Module
module RedisHelper
def is_redis_open?
begin
Timeout::timeout(1) do
begin
s = TCPSocket.new(REDIS_CONFIG['server_url'], 6379)
s.close
return true
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
return false
@shooley
shooley / properties.xml
Created March 30, 2011 19:40
Commons Configuration properties.xml
<configuration>
<header>
<result delimiterParsingDisabled="true" forceReloadCheck="true">
<nodeCombiner config-class="org.apache.commons.configuration.tree.OverrideCombiner"/>
</result>
</header>
<override>
<properties fileName="/usr/local/tomcat6/conf/application.override.properties">
<reloadingStrategy config-class="org.apache.commons.configuration.reloading.FileChangedReloadingStrategy"/>
</properties>
@shooley
shooley / gist:892377
Created March 29, 2011 13:42
Commons Configuration Property Manager
import org.apache.commons.configuration.CombinedConfiguration;
public class PropertyManager {
private String YOUR_PROPERTY_FILE = "properties.xml";
private static CombinedConfiguration combinedConfiguration =
CommonsConfigurationUtility
.createConfiguration(YOUR_PROPERTY_FILE);
private PropertyManager() { }
@shooley
shooley / gist:876957
Created March 18, 2011 22:19
Spring XML Namespaces and Schema's
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">