Skip to content

Instantly share code, notes, and snippets.

bash 'extract_module' do
cwd ::File.dirname(src_filepath)
code <<-EOH
mkdir -p #{extract_path}
tar xzf #{src_filename} -C #{extract_path}
mv #{extract_path}/*/* #{extract_path}/
chown -R #{jboss_user}:#{jboss_user} #{extract_path}
find #{extract_path}/ -exec chmod g+w {} \;
EOH
not_if { ::File.exists?(extract_path) }
ark "zabbix_agent" do
name "zabbix"
url node['zabbix']['agent']['prebuild']['url']
owner node['zabbix']['agent']['user']
group node['zabbix']['agent']['group']
action :put
path "/opt"
strip_leading_dir false
has_binaries [ 'bin/zabbix_sender', 'bin/zabbix_get', 'sbin/zabbix_agent', 'sbin/zabbix_agentd' ]
notifies :restart, "service[zabbix_agentd]"

Dashing dashboard for zabbix trigger

zabbix trigger zabbix trigger

This will provide the total number of alerts on triggers status

  • flash when there's an alert/triggers (color based on the zabbix trigger color format)
  • trigger = Warning, Average, High & Disaster
  • unacknowledge triggers
# Installs Maven 3.1.1
node.override['maven']['3']['version'] = "3.1.1"
node.override['maven']['3']['checksum'] = "077ed466455991d5abb4748a1d022e2d2a54dc4d557c723ecbacdc857c61d51b"
include_recipe 'maven'
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
EndSection
Section "Files"
EndSection
@andrewfraley
andrewfraley / gist:fee28eaa91002f73c249
Last active August 29, 2015 14:23
Puppet loop scope
$letter = 'z'
$list = ['a', 'b', 'c']
$list.each |$item| {
if $item == 'b' {
$letter = 'b'
notify{"Letter: ${letter}": }
}
}
notify{"Letter: ${letter}": }
def organization = 'IT-Puppet'
def github_url = 'https://your-github-enterprise.local'
def page = 1
def linkHeader = 'rel="next"'
def pages = []
while (linkHeader =~ /.*rel="next"/ ) {
repoApi = new URL("${github_url}/api/v3/orgs/${organization}/repos?page=${page}")
@andrewfraley
andrewfraley / verify_github_webhook_signature.py
Created March 12, 2019 21:19
Validate Github webhook signature/secret in python3
def validate_signature(payload, secret):
# Get the signature from the payload
signature_header = payload['headers']['X-Hub-Signature']
sha_name, github_signature = signature_header.split('=')
if sha_name != 'sha1':
print('ERROR: X-Hub-Signature in payload headers was not sha1=****')
return False
# Create our own signature
@andrewfraley
andrewfraley / autohotkey_osx_shortcuts_for_windows.ahk
Last active March 31, 2023 01:32
add windows terminal alt+~ shortcut
; https://medium.com/@andrew.fraley/osx-like-keyboard-shortcuts-for-windows-10-113cfd532699
; https://gist.github.com/andrewfraley/1055b7411e0215c98a43fda25bb085d0
; alt = !
; win = #
#SingleInstance force
; Make ctrl-a and ctrl-e go to the end and beginning of lines by sending home and end keys
$^a::send {Home}
$^e::send {End}
@andrewfraley
andrewfraley / ubuntu_template_cleanup.sh
Last active January 17, 2022 23:52
Used to do final cleanup on a Ubuntu 20.04 image template
# Apply updates and clear apt cache
echo "Applying updates and clearing apt cache"
apt update && apt -y upgrade && apt -y autoremove && apt clean
# Clear this to regen this file (you can't delete it). Otherwise DHCP will give the same IP to every system built with this
echo "Clearing /etc/machine-id"
truncate -s0 /etc/machine-id
echo "Running cloud-init clean"
cloud-init clean