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
@h0tw1r3
h0tw1r3 / docker_cleanup_beaker.sh
Created February 21, 2023 21:45
shell function to cleanup beaker docker containers
# clean up all beaker containers and images
# useful when using BEAKER_destroy=no
function docker-cleanup-beaker() {
while read i; do
X=($i)
echo -n "Cleaning up ${X[2]}: stopping container"
docker stop "${X[0]}" >/dev/null
echo -n ", removing container"
docker rm "${X[0]}" >/dev/null
echo -n ", removing images"
@h0tw1r3
h0tw1r3 / psmouse
Created January 22, 2023 19:33
Linux on Lenovo Thinkpad S1 Yoga
#!/bin/sh
# trackpad and trackpoint are connected to the ps port
# psmouse is not hotplug friendly
# must be removed before sleep
# place this file in /lib/systemd/system-sleep
# and chmod +x
PATH=/sbin:/usr/sbin:/bin:/usr/bin
@h0tw1r3
h0tw1r3 / pe-backup.sh
Last active August 29, 2023 15:15
Puppet Enterprise auto-rotate puppet-backup wrapper
#!/bin/bash
#
# Puppet Enterprise backup script
#
# Limits retained backup archives
# Optionally creates a backup of the PE service secure keys
#
# All arguments supplied via environment variables.
#
# License: MIT
@h0tw1r3
h0tw1r3 / ExtendedUnrar.py3
Created January 5, 2023 01:43
Extension Script to extract embedded rars for NZBget
#!/usr/bin/env python3
"""
ExtendedUnrar post-processing script for NZBGet
Copyright (C) 2023 h0tw1r3
Copyright (C) 2014 thorli <thor78@gmx.at>
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 2 of the License, or
@h0tw1r3
h0tw1r3 / rand.rb
Created January 2, 2023 19:13
puppet custom functions
# Return a random number
Puppet::Functions.create_function(:rand) do
# @param [Integer] max
# maximum random number
# @return [Variant[Integer,Float]]
# random number
# @example Calling the function
# rand(10)
dispatch :generate_random_number do
optional_param 'Integer', :max
@h0tw1r3
h0tw1r3 / PROXMOX_SOLARIS_INSTALL.md
Last active March 2, 2024 04:42
Solaris 11.4 CDE Install Proxmox
@h0tw1r3
h0tw1r3 / apply.pp
Last active October 20, 2022 21:56
Allow PE puppet nodes API access to delete their own certificate
pe_puppet_authorization::rule { 'allow-ca-client-delete-self':
match_request_path => '/puppet-ca/v1/certificate_status/([^/]+)$',
match_request_type => 'regex',
match_request_method => ['delete'],
allow => '$1',
sort_order => 500,
path => "/etc/puppetlabs/puppetserver/conf.d/auth.conf",
notify => Service['pe-puppetserver'],
}
@h0tw1r3
h0tw1r3 / 99-bottles-of-beer.pp
Created August 29, 2022 16:40
Puppet 99 Bottles of Beer on the Wall
$bottles = Integer[0,99].map |$bottle| { abs($bottle - 99) }
$report = {
bottles => '%s bottle%s of beer on the wall, %s bottle%s of beer.',
left => '%s bottle%s of beer on the wall.',
take => 'Take one down and pass it around',
buy => 'Go to the store and buy some more',
}
$bottles.map |$bottles_on_wall| {
@h0tw1r3
h0tw1r3 / nessusagent.pp
Last active October 26, 2022 17:35
Deploy nessus agent with Puppet
class nessusagent (
String $agent_key,
Array[String] $agent_groups = ['All'],
String $agent_name = $facts['networking']['hostname'],
String $nessus_host = 'cloud.tenable.com',
Integer $nessus_port = 443,
String $package_name = 'NessusAgent',
Hash $package_params = {
ensure => 'latest',
},
@h0tw1r3
h0tw1r3 / homebrew.pp
Last active July 28, 2022 21:43
Deploy shared homebrew on Linux
class homebrew (
Array[String] $packages = ['procps-ng', 'curl', 'file', 'git'],
) {
yum::group { 'Development Tools':
ensure => present,
}
-> package { $packages:
ensure => present
}
-> user { 'linuxbrew':