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 / 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 / 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 / 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 / manipulate_qdisc.py
Last active August 11, 2017 13:10 — forked from jolynch/manipulate_qdisc.py
Shows how to manipulate a plug qdisc manually using pyroute2
import pyroute2
from pyroute2 import IPRoute
from pyroute2.iproute import transform_handle
from pyroute2.netlink import NLM_F_ACK
from pyroute2.netlink import NLM_F_REQUEST
from pyroute2.netlink.rtnl.tcmsg import tcmsg
PLUG_CLASS = '1:4'
PLUG_QDISC = '40:'
@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 / 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 / cockpit_trusty.md
Last active December 12, 2021 03:56
Cockpit on Ubuntu Trusty 14.05

Installing Cockpit on Trusty

Doesn't really work too well, assumes systemd which isn't present, installation steps are as follows:

sudo add-apt-repository ppa:jpsutton/cockpit
sudo apt-get update
sudo apt-get install cockpit
sudo apt-get install glib-networking
sudo apt-get install pcp
sudo /usr/sbin/remotectl certificate --ensure --user=root
@johnmccabe
johnmccabe / test_catalog.bom
Created January 13, 2016 11:45
#212 test
brooklyn.catalog:
version: 0.9.0-SNAPSHOT # BROOKLYN_VERSION
items:
# load everything in the classpath with a @Catalog annotation
- scanJavaAnnotations: true
- id: server
description: |
Provision a server, with customizable provisioning.properties and credentials installed,