Skip to content

Instantly share code, notes, and snippets.

Dick Davies rasputnik

Block or report user

Report or block rasputnik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rasputnik
rasputnik / gist:155aa11277147178fe8f
Created Jun 12, 2014
marathon 0.5.1 Dockerfile
View gist:155aa11277147178fe8f
# run marathon 0.5.1 against mesos 0.18.2
#
# docker build -t 'your/marathon051' <directory-holding-this-file>
#
# then run with:
# docker run -name marathon -d your/marathon051 ..... command line args ....
#
# logs via : docker logs -f marathon
FROM centos
@rasputnik
rasputnik / gist:376b9e69426afa0f43bd
Created Jun 20, 2014
apache vhost template for graphite
View gist:376b9e69426afa0f43bd
# <%= @sysadmin_beware %>
# This configuration assumes the default installation prefix
# of /usr/share/graphite/
<% #grab some variables
wsgifile = scope.lookupvar("graphite::settings::wsgipath")
-%>
<IfModule !wsgi_module.c>
LoadModule wsgi_module modules/mod_wsgi.so
</IfModule>
@rasputnik
rasputnik / gist:98aac2f8230a26f06e64
Created Sep 23, 2014
find marathon master using zk CLI tool
View gist:98aac2f8230a26f06e64
Although marathon nodes proxy to the master, that will only happen if they're alive to proxy :)
We've worked around this by using https://github.com/mmcgrana/zk to find the current marathon master from zookeeper and make the request to that. Something like:
export ZOOKEEPER_SERVERS=zk://.......
export MARATHON_ZNODE=/marathon
export LEADER=$MARATHON_ZNODE/leader
# find marathon master (each active master shows here, just grab the last)
@rasputnik
rasputnik / mesos-slave.py
Created Feb 11, 2015
mesos slave collectd plugin (mesos 0.21.x)
View mesos-slave.py
#! /usr/bin/python
# Copyright 2014 Ray Rodriguez
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@rasputnik
rasputnik / site.yml
Created Apr 29, 2015
conditional role loading:
View site.yml
- hosts: frontends
roles:
- { role: bamboo, when: discovery == 'bamboo' }
- { role: mesos-dns, when: discovery == 'mesos-dns' }
View gist:125874
production:
adapter: jdbc
username: me
password: sssh
driver: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@dbhost:1521:dbname
# run with 'jruby -S sequel -e production database.yml
@rasputnik
rasputnik / ImageSizer
Created Oct 12, 2009
Rack Middleware to tell you dimensions of an image
View ImageSizer
# JRuby version of ImageScience (other image toolkits are available)
require 'image_voodoo'
class ImageSizer
def initialize(app, mime_types=%w[image/jpeg image/png image/gif])
@app = app
@mime_types = mime_types
end
def call(env)
View counter.js
module.exports = function counterSetup(logcheckpoint) {
var hitcount = 0;
var logcheckpoint = logcheckpoint || 1000;
return function hitCount(req, res, next) {
hitcount++;
if (hitcount % logcheckpoint == 0 ) {
console.log(hitcount + " hits");
}
next();
View argh can't do case statements
class mongodb::repo {
yumrepo { "10gen repository":
enabled => 1,
descr => "10gen repository",
baseurl => case $architecture {
i686: {"http://downloads.mongodb.org/distros/centos/5.4/os/x86_64/"}
default: { "baseurl=http://downloads.mongodb.org/distros/centos/5.4/os/i386/"}
},
gpgcheck => 0
}
View gist:703220
cron { "logshipping.cronjob":
command => $logshippingscript,
require => File[$logshippingscript],
hour => 15,
minute => 01,
user => "apache"
}
file { $logshippingscript :
owner => apache,
You can’t perform that action at this time.