Skip to content

Instantly share code, notes, and snippets.

View cmattoon's full-sized avatar

Curtis Mattoon cmattoon

View GitHub Profile
#!/bin/bash
SRC_CONF="/etc/puppetlabs/puppet/puppet.conf"
SSL_DIR="/etc/puppetlabs/puppet/ssl"
sed -i "s/ctpuppetmaster01/ctpuppetconsole02/" $SRC_CONF
mv -f "${SSL_DIR}" "${SSL_DIR}.pe"
mv -f /etc/puppetlabs/mcollective/ssl /etc/puppetlabs/mcollective/ssl.pe
#systemctl stop pe-mcollective
service pe-mcollective stop
puppet agent --test --debug --noop
exit 0;
@cmattoon
cmattoon / fs.txt
Created June 2, 2017 19:58
Filesystem differences between PE and CE
[root@ctpuppetconsole01 ~]# find / -name 'puppet' -type d
=========================================================
/var/opt/lib/pe-puppet/lib/puppet
/opt/puppet
/opt/puppet/share/puppet
/opt/puppet/share/puppet/modules/pe_concat/lib/puppet
/opt/puppet/share/puppet/modules/reboot/lib/puppet
/opt/puppet/share/puppet/modules/pe_staging/spec/unit/puppet
/opt/puppet/share/puppet/modules/pe_staging/lib/puppet
/opt/puppet/share/puppet/modules/pe_inifile/spec/unit/puppet
@cmattoon
cmattoon / install_puppet.sh
Created June 2, 2017 19:08
Script to Install Puppet on CentOS 7
#!/bin/bash
# Installs Puppet on CentOS 7
# @todo - check GPG key
RPM=$(which rpm)
CENTOS_REPO_URL="https://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm"
GPG_PUBKEY="http://pool.sks-keyservers.net:11371/pks/lookup?op=get&search=0x1054B7A24BD6EC30"
function install_centos_repo() {
$RPM -ivh $CENTOS_REPO_URL
@cmattoon
cmattoon / rpkg.py
Last active May 31, 2017 02:01
Install R packages on ShinyServerPro
#!/usr/bin/env python
"""
Install R Packages from the command line
Usage: (parse app.R)
./rpkg app.R
Usage: (install R packages)
./rpkg shiny V8 plyr
"""
@cmattoon
cmattoon / .gitconfig
Created May 27, 2017 21:02
~/.gitconfig
# This is Git's per-user configuration file.
[user]
# Please adapt and uncomment the following lines:
name = Your Name
email = <your_email@domain.com>
[core]
editor = emacs
[alias]
# List all aliases
la = "!git config -l | grep alias | cut -c 7-"
@cmattoon
cmattoon / python_sloc.sh
Created May 23, 2017 02:04
Python SLOC
#!/bin/bash
# pip install metrics
find . -name '*.py' \|
xargs metrics -q --format csv -f \|
cut -d',' -f 6 \|
tail -n +4 \|
paste -sd+ - \|
sed s'/.$//' \|
bc
# Display all log entries for each MAC address
cat /var/log/api-fetcher.log | grep 'Sending Group SMS for'
# Get a list of MAC addresses only
cat /var/log/api-fetcher.log | grep 'Sending Group SMS for' | cut -d' ' -f 9
# Get a list of unique MAC addresses
cat /var/log/api-fetcher.log | grep 'Sending Group SMS for' | cut -d' ' -f 9 | uniq
@cmattoon
cmattoon / hosts.go
Last active December 10, 2016 15:49
package main
import (
"os"
"io/ioutil"
"strings"
"sort"
)
// Because this doesn't exist?
#!/usr/bin/env python
"""
Convert argv[1] from list (array) to dict (object)
"""
import sys, json
OUTFILE = 'test-output.json'
with open(sys.argv[1]) as fd:
data = json.loads(fd.read())
@cmattoon
cmattoon / termproc.py
Last active April 22, 2016 20:17
Terminal Procedures Downloader
#!/usr/bin/env python
import re, os, sys, errno, requests, urllib2
from bs4 import BeautifulSoup
from PyPDF2 import PdfFileMerger, PdfFileReader
DOWNLOAD_PATH = "pdf"
IFR = False
def mkdir_p(path):