Skip to content

Instantly share code, notes, and snippets.

View KushalP's full-sized avatar

Kushal Pisavadia KushalP

View GitHub Profile
@KushalP
KushalP / config.toml
Created January 24, 2014 16:58
Stacktrace when trying to run https://github.com/mozilla-services/heka/compare/dev...features;issue_372 are building using `hekad -config=config.toml`
[hekad]
decoder_poolsize = 5
max_message_loops = 8
max_process_inject = 10
max_timer_inject = 20
maxprocs = 4
plugin_chansize = 10
poolsize = 200
[somehekalogstreamstuff]
@KushalP
KushalP / json_log_decode.lua
Created January 23, 2014 19:51
Example of a Heka Lua Sandbox decoder that will take JSON log lines (and some extra decoder config) and stream that information into the `Fields` variables of the Heka message.
require "cjson"
-- Generic decoder for JSON logs. This will extract all JSON
-- keys and add them to the `Fields` variable of the created
-- Heka message.
--
-- Example use:
--
-- [NginxJsonLogDecoder]
-- type = "SandboxDecoder"
from peewee import *
DATABASE = SqliteDatabase("hosts.db")
class BaseModel(Model):
class Meta:
database = DATABASE
class Hosts(BaseModel):
name = CharField(max_length=256)
#!/usr/bin/env python
"""
Harbour.
Usage:
harbour [ID] env
harbour [ID] ports
harbour (-h | --help)
[hekad]
decoder_poolsize = 5
max_message_loops = 8
max_process_inject = 10
max_timer_inject = 20
maxprocs = 4
plugin_chansize = 10
poolsize = 200
[debug]
{
"template": "logs-*",
"order": 0,
"settings": {
"index.query.default_field": "Payload",
"index.store.compress.stored": "true",
"index.number_of_shards": "5",
"index.cache.field.type": "soft",
"index.refresh_interval": "5s"
},
{
"title": "Platform Logs",
"services": {
"query": {
"idQueue": [
1,
2,
3,
4
],
@KushalP
KushalP / facts_data.sql
Last active December 27, 2015 17:49
Example dummy data for historical facts in PuppetDB
BEGIN;
INSERT INTO certnames (name, deactivated) VALUES ('dummy', NOW());
INSERT INTO certname_facts_metadata (certname, timestamp) VALUES ('dummy', NOW());
INSERT INTO certname_facts (certname, name, value) VALUES ('dummy', 'REVISION', 'SOME SHA1');
COMMIT;
@KushalP
KushalP / multiply.py
Created October 23, 2013 13:37
A real drawn out example (it's bad) to show how private methods in Python work
class Multiply(object):
def __init__(self, x, y):
self.x, self.y = x, y
def value(self):
return self.__multiply(self.x, self.y)
def __multiply(self, x, y):
return x * y
# language: en
Feature: vCloud madness
In order to write cucumber features correctly
As a webop
I need to wrap everything I do around "features"
Scenario: Login
Given an account on the Skyscape portal
And a vCloud organisation
When I login to the vCloud API