Skip to content

Instantly share code, notes, and snippets.

View discreet's full-sized avatar

Chris Pisano discreet

  • Morning Consult
  • Washington D.C.
View GitHub Profile
### Keybase proof
I hereby claim:
* I am discreet on github.
* I am discr33t (https://keybase.io/discr33t) on keybase.
* I have a public key ASDq3mDQWuFKD7WscGCh3kUg0K5J3EgeeHrVtT-kLJByPwo
To claim this, I am signing this object:
class repos::rsyslog inherits repos {
yumrepo { "rsyslog-v8-stable-el${::operatingsystemmajrelease}":
ensure => present,
descr => "Adison Rsyslog v8-stable for CentOS el${::operatingsystemmajrelease}",
baseurl => "https://${repos::repoweb}/repos/${repos::repomonth}/rsyslog-v8-stable_el${::operatingsystemmajrelease}",
enabled => '1',
gpgcheck => '1',
gpgkey => "https://${repos::repoweb}/pub/RPM-GPG-KEY-Adiscon",
}
@discreet
discreet / Advanced Init Logic
Created September 23, 2016 18:26
Advanced logic for server type config
class foo {
$stype = $::tier
if !defined("::foo::${stype}") {
fail("The server type of ${::tier} is invalid")
}
include "::foo::${stype}"
}
@discreet
discreet / Init Logic
Created September 23, 2016 17:20
Logic for server type config
class foo {
case $::tier {
'websphere': { include '::foo::websphere' }
'dbora': { include '::foo::dbora' }
'monbot': { include '::foo::monbot' }
'tomcat': { include '::foo::tomcat' }
default: { fail("blah blah blah") }
}
}
@discreet
discreet / HomeDir_Layout
Last active September 22, 2016 16:55
Find the HomeDir layout with a Fact to set the template command accordingly
require 'facter'
Facter.add("homedir_layout") do
confine :osfamily => 'RedHat'
setcode do
if File.exists?("/home/local")
layout = 'legacy'
else
layout = 'current'
end
@discreet
discreet / bosun-mirror.rb
Last active September 9, 2016 21:20
Mirror the latest release of Bosun using the GitHub API
require 'rubygems'
require 'json'
require 'faraday'
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.8.7')
fail("Ruby >= 1.8.7 is required")
end
def which(cmd)
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
curl -k -X POST -H "Accept: application/json" \
-H "Accept: application/json" -H "Content-Type: application/json" \
-H "Cache-Control: no-cache" -u "username:password" \
-d '
{
"host": {
"name": "<instance_id>",
"organization_id": 4,
"location_id": 12,
"hostgroup_id": <hostgroup_id>,
@discreet
discreet / string hash
Created September 29, 2014 20:30
string hash
m = hashlib.sha512()
m.update("your_password")
print m.hexdigest()
@discreet
discreet / passwordgen.py
Created September 29, 2014 20:29
password generator with hash
import os, random, string, hashlib
length = 23
chars = string.ascii_letters + string.digits + '!@#$%^&*()'
rnd = random.SystemRandom()
rpass = ''.join(rnd.choice(chars) for i in range(length))
m = hashlib.sha1()
m.update(rpass)
@discreet
discreet / duplicateDel.py
Created September 29, 2014 14:35
Removes duplicate entries in Spacewalk
#!/usr/bin/python
import xmlrpclib,sys
import socket
SATELLITE_URL = "http://serverdnsname/rpc/api"
#User account to connect to satellite server
SATELLITE_LOGIN = "<user to delete account>"
#Password for above connection
SATELLITE_PASSWORD = "<password>"
#Accept an argument