Skip to content

Instantly share code, notes, and snippets.

Avatar
🏝️
Living the dream

Jeffrey Clark h0tw1r3

🏝️
Living the dream
View GitHub Profile
@h0tw1r3
h0tw1r3 / superscrub.pl
Last active Mar 6, 2017
Recurse directory tree, scrubbing lines based that match pattern list. Bzip compressed files supported.
View superscrub.pl
#!/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 / fstab.pp
Created Feb 26, 2017
Hacky way to apply mount options to fstab entries
View fstab.pp
class profile::fstab {
define fstab::mount($options) {
$mount = $title
exec { "fstab_remount_${mount}":
command => "/bin/env mount -o remount ${title}",
refreshonly => true
}
@h0tw1r3
h0tw1r3 / rclocal.service
Last active Jan 18, 2017
systemd rc.local compatibility
View rclocal.service
[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
View raw2jpg.sh
#!/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 / netaddr
Created Oct 13, 2016
Filter IPv4 addresses by network
View netaddr
#!/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.
#
@h0tw1r3
h0tw1r3 / rpm_packages.rb
Created Sep 9, 2016
puppet fact for rpm _packages
View rpm_packages.rb
require 'facter'
def hash_tree
Hash.new do |hash, key|
hash[key] = hash_tree
end
end
Facter.add(:packages) do
confine :osfamily => 'Redhat'
View nginx auth proxy apache multiple sites
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;
View LXC Centos 7 - Setup Puppet Master.sh
#!/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
@h0tw1r3
h0tw1r3 / raw2jpg.sh
Last active Mar 24, 2018
Parallel recursive RAW to JPEG + meta converter shell script
View raw2jpg.sh
!/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 / ip_addresses.pp
Created Jul 23, 2016
Puppet 4+ snippets
View ip_addresses.pp
$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']}" )
}
}
}