Skip to content

Instantly share code, notes, and snippets.

View hanynowsky's full-sized avatar
💭
I may be slow to respond.

Hanynowsky hanynowsky

💭
I may be slow to respond.
View GitHub Profile
@hanynowsky
hanynowsky / random-magic-cube.rb
Created May 3, 2016 09:03 — forked from justinburdett/random-magic-cube.rb
This Ruby script generates a random list of Magic: the Gathering cards, ideally for use in making a random Magic cube, and outputs the card list into a text file (suitable for importing into Magic Online or for use in bulk card shopping). For more information on cube drafting, see cubedrafting.com. You can modify the number of cards generated an…
require 'nokogiri'
require 'open-uri'
print "How many cards? "
CARDS_IN_CUBE = gets.strip.to_i
print "What format? "
LEGAL_IN_FORMAT = gets.strip
card_count = 1
# Create or open a text file in the same directory as this file and stores the card names there.
1. Download the plugin from: https://github.com/sensu/sensu-community-plugins/blob/master/handlers/remediation/sensu.rb
2. Create the handler definition:
{
"handlers": {
"remediator": {
"type": "pipe",
"command": "/etc/sensu/handlers/remediator.rb"
}
}
}
- name: Update cpucrit threshold
lineinfile: 'dest=/etc/sensu/conf.d/standalone/user/thresholds_client.json regexp=(.*)cpucrit(.*) line=\"cpucrit\":{{ item }},'
with_items:
- "{{ cpucrit }}"
when: cpucrit is defined
tags:
- mbt
#!/bin/bash
# Make sure we have the dev tools
yum groupinstall "Development Tools"
# Just in case you started installing dependencies from yum
yum -y remove libnfnetlink
# lets put the source code here
mkdir -p ~/.src
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
Error: selected is undefined
this.getSelected@https://monitor.magic.fr/bower_components/uchiwa-web/js/common.js?rel=1479176171587:54:5
this.silence@https://monitor.magic.fr/bower_components/uchiwa-web/js/services.js?rel=1479176171588:255:26
$scope.silence@https://monitor.magic.fr/bower_components/uchiwa-web/js/controllers.js?rel=1479176171587:273:7
anonymous/fn@https://monitor.magic.fr/bower_components/angular/angular.min.js?rel=1479176171588 line 218 > Function:2:409
b@https://monitor.magic.fr/bower_components/angular/angular.min.js?rel=1479176171588:116:148
Ic[b]</<.compile/</</e@https://monitor.magic.fr/bower_components/angular/angular.min.js?rel=1479176171588:259:195
sf/this.$get</n.prototype.$eval@https://monitor.magic.fr/bower_components/angular/angular.min.js?rel=1479176171588:135:215
sf/this.$get</n.prototype.$apply@https://monitor.magic.fr/bower_components/angular/angular.min.js?rel=1479176171588:135:447
Ic[b]</<.compile/</<@https://monitor.magic.fr/bower_components/angular/angular.min.js?rel=1479176
require "sensu/extension"
require 'redis'
require 'json'
require 'socket'
require 'time'
# Author: MOL - November 2016
# Sensu: Tested on 0.26.5
# License: MIT
# This Sensu extension handler sends sensu events to a logstash instance
@hanynowsky
hanynowsky / gist:0ea68ce8405038945fe1736abc0d01a2
Created November 28, 2016 13:56 — forked from juanje/gist:1310403
Use Ruby as AWK or Grep
# A few examples about how to use Ruby for parsing files as we could do
# with Awk or Grep. This is based on what I learn fro this post:
# http://code.joejag.com/2009/using-ruby-as-an-awk-replacement/
# Split each line with ':' and print the first $F[0] field
awk -F: '{ print $1 }' /etc/passwd
ruby -F: -nae 'puts $F[0]' /etc/passwd
# Parse the 'ps aux' output
# It'll print the ID process for the 'jojeda' user
#!/usr/bin/env ruby
# Magic Online 2016
# # This extension mutator is supposed to format sensu events to InfluxDb line format
#! /usr/bin/env ruby
#
# mutator-influxdb-line-protocol
#
# DESCRIPTION:
# Mutates check results to conform to InfluxDB's line protocol format
#
#! /usr/bin/env ruby
#
# metrics-netstat-tcp
#
# DESCRIPTION:
# Fetch metrics on TCP socket states from netstat. This is particularly useful
# on high-traffic web or proxy servers with large numbers of short-lived TCP
# connections coming and going.
#
# OUTPUT: