Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Schwartz benschw

View GitHub Profile
@benbjohnson
benbjohnson / gist:8338908
Created Jan 9, 2014
Cross Compile w/ drone.io
View gist:8338908
# 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 Jul 31, 2016
Installing GoLang - Ubuntu 12.04.3 LTS \n \l
View goinst.sh
#!/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 Dec 25, 2015
An attempt at explaining promises.
View promises.md

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 Sep 10, 2013
Sample code to load archaius properties statically via spring
View Configurer
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 Sep 4, 2013
Example of configuring Archaius through Spring XML. Package names have been removed, so this probably won't work without some modification.
View ConcurrentCompositeConfigurationFactory.java
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 Oct 13, 2012
Mount the HTC One X on Linux (Ubuntu 12.04 Precise)
View go-mtpfs.md
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 Feb 2, 2012
example json data passed into Sensu handlers via STDIN
View sensu-handler-input-example.json
{
"client":{
"name":"host01",
"address":"10.2.1.11",
"subscriptions":[
"all",
"env_qa",
"frontend",
"proxy",
"apache"