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 / aria2.daemon
Last active April 16, 2024 22:30
Aria2c systemd service
continue
dir=/var/www/downloads
file-allocation=falloc
max-connection-per-server=4
max-concurrent-downloads=2
max-overall-download-limit=0
min-split-size=25M
rpc-allow-origin-all=true
rpc-secret=YouShouldChangeThis
input-file=/var/tmp/aria2c.session
@h0tw1r3
h0tw1r3 / PROXMOX_SOLARIS_INSTALL.md
Last active March 2, 2024 04:42
Solaris 11.4 CDE Install Proxmox
@h0tw1r3
h0tw1r3 / spec_described.rb
Last active February 4, 2024 16:27
Rake task for puppet modules to ensure spec describes cover the code
require 'rspec/core'
namespace :check do
desc "Check to ensure defined puppet code has been described in spec\n(defaults: coverage=100)"
task :spec_described, [:coverage] do |_task, args|
args.with_defaults(coverage: '100')
def pluralize(string)
string.end_with?('s') ? "#{string}es" : "#{string}s"
end
@h0tw1r3
h0tw1r3 / logback.pp
Created February 1, 2024 20:00
send puppetserver logs to syslog
augeas { 'puppetserver-logback-journal':
incl => '/etc/puppetlabs/puppetserver/logback.xml',
lens => 'Xml.lns',
changes => [
"defnode aref configuration/root/appender-ref[#attribute/ref='STDOUT'] ''",
"set \$aref/#attribute/ref 'STDOUT'",
]
}
@h0tw1r3
h0tw1r3 / ghostbuster.sh
Last active January 19, 2024 21:53
no requirements ghostbuster for puppet enterprise control-repo modules
#!/bin/bash
#####> BEGIN: script init
set -o pipefail -o errtrace -o errexit -o nounset -o functrace
__traperror() {
local el=${1:=??} ec=${2:=??} lc="$BASH_COMMAND"
printf "ERROR in %s : line %d error %d\\n [%s]\\n" "$0" "$el" "$ec" "$lc" 1>&2
exit "${2:=1}"
}
@h0tw1r3
h0tw1r3 / Gemfile
Created January 18, 2024 19:38
Puppet Testing Gemfile
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
def location_for(place_or_version, fake_version = nil)
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
file_url_regex = %r{\Afile:\/\/(?<path>.*)}
if place_or_version && (git_url = place_or_version.match(git_url_regex))
[fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
elsif place_or_version && (file_url = place_or_version.match(file_url_regex))
['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
@h0tw1r3
h0tw1r3 / fakeprovide.pp
Created January 10, 2024 16:39
fakeprovide rpm resource type for puppet
# fake provide rpm dependencies
#
# requires stdlib module
#
# @param provide
# what to provide
# @param extras
# extra provides to add to package
#
# @example
@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 / 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 / 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