Skip to content

Instantly share code, notes, and snippets.

View johnmccabe's full-sized avatar
🍕
eat sleep rebase repeat

John McCabe johnmccabe

🍕
eat sleep rebase repeat
View GitHub Profile
@johnmccabe
johnmccabe / README.md
Last active August 29, 2015 14:21 — forked from mbostock/.block

This example is the second of three in the Path Transitions tutorial; see the previous example for context.

The desired pairing of numbers for path interpolation is like this:

M x0, y0 L x1, y1 L x2, y2 L x3, y3 L xR, y4
   ↓   ↓    ↓   ↓    ↓   ↓    ↓   ↓
M xl, y0 L x0, y1 L x1, y2 L x2, y3 L x3, y4

Where xl is some negative value off the left side, and xr is some positive value off the right side. This way, the first point ⟨x0,y0⟩ is interpolated to ⟨xl,y0⟩; meaning, the x-coordinate is interpolated rather than the y-coordinate, and so the path appears to slide off to the left. Likewise, the incoming point ⟨xr,y4⟩ is interpolated to ⟨x3,y4⟩.

@johnmccabe
johnmccabe / README.md
Last active December 8, 2015 12:51
Brooklyn/Clocker Logback Settings for IntelliJ Run Configurations

By default when you create a Run Configuration for Brooklyn in IntelliJ it logs in full DEBUG mode. You can however override the classpath logback.xml.

Set the following VM Option in your Brooklyn Application Run Configuration, this should be a full path, using ~ doesn't work:

-Dlogback.configurationFile="/full/path/to/logback.xml"

An example logback configuration file is shown below, note that the appenders etc are being pulled from the classpath.

@johnmccabe
johnmccabe / apachetest.pp
Last active December 22, 2015 14:58
Checking how to install php with apache using puppetlabs-apache
class { 'apache':
default_vhost => false,
mpm_module => prefork
}
include apache::mod::rewrite
include apache::mod::php
apache::vhost { "www.testdomain.com":
vhost_name => '*',
@johnmccabe
johnmccabe / gist:6497518
Last active December 22, 2015 16:09
Breaking up hashes into lists based on values in the hash?
$hosts => {
'a.domain.com' => {
someparam => somevalue,
tags => [ 'red' ],
},
'b.domain.com' => {
someparam => someothervalue,
tags => [ 'red', 'green' ],
},
}
@johnmccabe
johnmccabe / init.pp
Last active December 22, 2015 18:09
Accessing var in base from declared type
class foo (
$testvalue = $foo::params::testvalue,
) inherits foo::params {
foo::somefunc { 'blah': }
}
@johnmccabe
johnmccabe / docker_util_bash_snippet.sh
Created December 23, 2015 10:57
Bash function to spin up docker cli
docker-cli-env(){
docker_machine_ip=`docker-machine ip default`
bash -c "clear && DOCKER_HOST=tcp://${docker_machine_ip}:2376 DOCKER_CERT_PATH=~/.docker/machine/machines/default DOCKER_TLS_VERIFY=1 /bin/bash"
}
@johnmccabe
johnmccabe / test.pp
Created September 26, 2013 21:42
stdlib delete behaviour?
[root@drone tests]# puppet apply j.pp
notice: Scope(Class[main]): testval is: blahblahblah-bin
notice: Finished catalog run in 0.42 seconds
I would have expected to see it return 'testval is: blahblahblah'
@johnmccabe
johnmccabe / USAGE.md
Last active January 25, 2016 10:34
Github checkout PR bash function

View Help

git_clone_pr

Checkout PR 1234 from the apache remote to default branch pr1234

git_clone_pr apache 1234
@johnmccabe
johnmccabe / USAGE.md
Last active January 26, 2016 21:37
Bash function(s) to download Youtube videos using Docker

Add the bash functions to your profile, either directly in ~/.bash_profile or preferably by loading the snippets from ~/.bash_profile.d - for example add the following to your .bash_profile:

# Run snippets
for script in ~/.bash_profile.d/*.sh ; do
        if [ -r $script ] ; then
                . $script
        fi
done
@johnmccabe
johnmccabe / steps.txt
Created February 17, 2016 11:14
compiling go cli
mkdir ~/tmp_gopath_dir
cd ~/tmp_gopath_dir
export GOPATH=`pwd`
go get -d github.com/brooklyncentral/brooklyn-cli/br
cd $GOPATH/src/github.com/brooklyncentral/brooklyn-cli/br
godep go install