Skip to content

Instantly share code, notes, and snippets.

@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 = <[email protected]>
[core]
editor = emacs
[alias]
# List all aliases
la = "!git config -l | grep alias | cut -c 7-"
@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 / 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 / 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
#!/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 / init.sh
Last active June 12, 2017 12:03
Init.sh
#!/bin/bash
# wget <raw_url>
# chmod +x init.sh
# ./init.sh
if [ "${EUID}" != "0" ]; then
echo "You must be root"
exit 1;
fi
#!/usr/bin/env python
"""
Creates a list of hosts from a CSV export of nodes
Usage: ./check_pe_csv path/to/csvfile
"""
import csv
import os
import sys
@cmattoon
cmattoon / carrotland.py
Last active June 18, 2017 02:45
Google foo.bar - Carrotland
"""
* Carrotland
* ==========
*
* The rabbits are free at last, free from that horrible zombie science experiment. They need a happy, safe home, where they can recover.
*
* You have a dream, a dream of carrots, lots of carrots, planted in neat rows and columns! But first, you need some land. And the only person who's selling land is Farmer Frida. Unfortunately, not only does she have only one plot of land, she also doesn't know how big it is - only that it is a triangle. However, she can tell you the location of the three vertices, which lie on the 2-D plane and have integer coordinates.
*
* Of course, you want to plant as many carrots as you can. But you also want to follow these guidelines: The carrots may only be planted at points with integer coordinates on the 2-D plane. They must lie within the plot of land and not on the boundaries. For example, if the vertices were (-1,-1), (1,0) and (0,1), then you can plant only one carrot at (0,0).
*
@cmattoon
cmattoon / Dockerfile
Created June 30, 2017 21:09
named-checkzone Docker image
FROM alpine:3.6
RUN apk update && apk add --no-cache bind
VOLUME ["/data"]
WORKDIR /data
ENTRYPOINT ["/usr/sbin/named-checkzone"]
@cmattoon
cmattoon / status
Created July 7, 2017 21:24
mock_status
The application is running