Skip to content

Instantly share code, notes, and snippets.

View benschw's full-sized avatar

Ben Schwartz benschw

View GitHub Profile
@benbjohnson
benbjohnson / gist:8338908
Created January 9, 2014 18:03
Cross Compile w/ drone.io
# This is what I have so far. The Go 1.2 installation doesn't seem to be correct so it's still breaking.
rm -rf /usr/local/go/src/pkg/appengine
rm -rf /usr/local/go/src/pkg/appengine_internal
rm /usr/local/go/src/pkg/os/error_posix.go
wget -O golang-crosscompile-master.zip https://github.com/davecheney/golang-crosscompile/archive/master.zip
unzip golang-crosscompile-master.zip
source golang-crosscompile-master/crosscompile.bash
go-crosscompile-build darwin/amd64
@jmervine
jmervine / goinst.sh
Last active July 31, 2016 02:36
Installing GoLang - Ubuntu 12.04.3 LTS \n \l
#!/usr/bin/env bash
#
# Example usage:
#
# $ VERSION=1.3 sudo ./goinst.sh
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@jclem
jclem / promises.md
Last active December 25, 2015 05:59
An attempt at explaining promises.

promises

Before Promises

Say in a JavaScript application, we need to make a request to http://www.example.com and then log the response. Let's walk through a few ways to do it.

Here's the worst way:

var result;
@chriswhitcombe
chriswhitcombe / Configurer
Created September 10, 2013 15:07
Sample code to load archaius properties statically via spring
public class ArchaiusPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {
@Override
protected String resolvePlaceholder(String placeholder, Properties props, int systemPropertiesMode) {
return DynamicPropertyFactory.getInstance().getStringProperty(placeholder, "null").get();
}
}
@mumrah
mumrah / ConcurrentCompositeConfigurationFactory.java
Created September 4, 2013 16:43
Example of configuring Archaius through Spring XML. Package names have been removed, so this probably won't work without some modification.
import org.apache.commons.configuration.AbstractConfiguration;
import com.netflix.config.ConcurrentCompositeConfiguration;
import java.util.ArrayList;
import java.util.List;
public class ConcurrentCompositeConfigurationFactory {
List<AbstractConfiguration> configs = new ArrayList<AbstractConfiguration>();
public void setConfigs(List<AbstractConfiguration> configs) {
@sandys
sandys / go-mtpfs.md
Created October 13, 2012 12:23
Mount the HTC One X on Linux (Ubuntu 12.04 Precise)
sudo apt-get install golang git mercurial
git clone https://github.com/hanwen/go-mtpfs.git
cd go-mtpfs
go build
sudo mv go-mtpfs /usr/local/sbin/go-mtpfs 
sudo chmod a+x /usr/local/sbin/go-mtpfs
sudo mkdir /media/mtp
sudo chmod 775 /media/mtp
sudo /usr/local/sbin/go-mtpfs -allow-other=true /media/mtp
@joemiller
joemiller / sensu-handler-input-example.json
Created February 2, 2012 11:33
example json data passed into Sensu handlers via STDIN
{
"client":{
"name":"host01",
"address":"10.2.1.11",
"subscriptions":[
"all",
"env_qa",
"frontend",
"proxy",
"apache"