Skip to content

Instantly share code, notes, and snippets.

View h0tw1r3's full-sized avatar
🏝️
Living the dream

Jeffrey Clark h0tw1r3

🏝️
Living the dream
View GitHub Profile
#!/bin/sh
localectl set-locale LANG=en_US.utf8
timedatectl set-timezone America/Chicago
rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
yum -y install puppetserver vim
map $remote_user $proxy_client_domain {
default $remote_user;
}
upstream newsline.linearcollider.org {
server 127.0.1.1:80;
}
upstream linearcollider.org {
server 127.0.2.1:80;
@h0tw1r3
h0tw1r3 / rpm_packages.rb
Created September 9, 2016 21:43
puppet fact for rpm _packages
require 'facter'
def hash_tree
Hash.new do |hash, key|
hash[key] = hash_tree
end
end
Facter.add(:packages) do
confine :osfamily => 'Redhat'
@h0tw1r3
h0tw1r3 / netaddr
Created October 13, 2016 01:37
Filter IPv4 addresses by network
#!/bin/bash
# NetAddr version 0.2 - Filter IPv4 addresses by network
# Copyright 2016 Jeffrey Clark <github.com/h0tw1r3>
# Copyright 2009 Ole Christian Tvedt <olechrt@stud.ntnu.no>
# 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.
#
#!/bin/env bash
#
# Parallel recursive RAW to JPEG + meta converter
#
# Output into relative JPEG directory
#
# Requires: dcraw, cjpeg, exiv2
# any argument means verbose...
if [ ${#} -ne 0 ]; then
@h0tw1r3
h0tw1r3 / rclocal.service
Last active January 18, 2017 15:56
systemd rc.local compatibility
[Unit]
Description=/etc/rc.local Compatibility
DefaultDependencies=false
ConditionFileIsExecutable=/etc/rc.local
After=multi-user.target
[Service]
Type=oneshot
ExecStart=/etc/rc.local
TimeoutSec=0
@h0tw1r3
h0tw1r3 / fstab.pp
Created February 26, 2017 02:24
Hacky way to apply mount options to fstab entries
class profile::fstab {
define fstab::mount($options) {
$mount = $title
exec { "fstab_remount_${mount}":
command => "/bin/env mount -o remount ${title}",
refreshonly => true
}
@h0tw1r3
h0tw1r3 / superscrub.pl
Last active March 6, 2017 18:31
Recurse directory tree, scrubbing lines based that match pattern list. Bzip compressed files supported.
#!/usr/bin/env perl
# Recurse tree for files, scrubbing lines based on pattern list
# Copyright: 2017 Jeffrey Clark <h0tw1r3@gmail.com>
# License: GNU GPL v3+
use strict;
use warnings;
no if $] >= 5.017011, warnings => 'experimental::smartmatch';
@h0tw1r3
h0tw1r3 / init.pp
Last active August 3, 2017 15:12
Puppet CA subjectAltName support (RFC 3280 4.2.1.7, 1. paragraph)
file { "puppet-ca-subjectaltname-patch":
path => "${::rubysitedir}/puppet/vendor/load_ca_hack.rb",
mode => '0644',
source => "puppet:///files/puppet/load_ca_hack.rb",
notify => Service[puppetmaster],
}
@h0tw1r3
h0tw1r3 / ip_addresses.pp
Created July 23, 2016 01:53
Puppet 4+ snippets
$facts['networking']['interfaces'].each() |$name, $values| {
$bindings = $values.filter |$key,$value| {
$key =~ /^bindings6?$/
}
$bindings.each |$bindingtype,$addresses| {
$addresses.each |$value| {
notice( "${name} with ip ${value['address']}" )
}
}
}