Skip to content

Instantly share code, notes, and snippets.

View rasputnik's full-sized avatar
💭
trying out graphiQL

rasputnik rasputnik

💭
trying out graphiQL
View GitHub Profile
@rasputnik
rasputnik / gist:155aa11277147178fe8f
Created June 12, 2014 09:47
marathon 0.5.1 Dockerfile
# 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 June 20, 2014 18:34
apache vhost template for graphite
# <%= @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 September 23, 2014 15:23
find marathon master using zk CLI tool
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 February 11, 2015 17:20
mesos slave collectd plugin (mesos 0.21.x)
#! /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 April 29, 2015 12:44
conditional role loading:
- hosts: frontends
roles:
- { role: bamboo, when: discovery == 'bamboo' }
- { role: mesos-dns, when: discovery == 'mesos-dns' }
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 October 12, 2009 13:33
Rack Middleware to tell you dimensions of an image
# 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)
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();
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
}
cron { "logshipping.cronjob":
command => $logshippingscript,
require => File[$logshippingscript],
hour => 15,
minute => 01,
user => "apache"
}
file { $logshippingscript :
owner => apache,