Skip to content

Instantly share code, notes, and snippets.

Andy Fraley andrewfraley

Block or report user

Report or block andrewfraley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@andrewfraley
andrewfraley / verify_github_webhook_signature.py
Created Mar 12, 2019
Validate Github webhook signature/secret in python3
View verify_github_webhook_signature.py
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
View puppet-jenkins-dsl.groovy
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}")
View gist:fee28eaa91002f73c249
$letter = 'z'
$list = ['a', 'b', 'c']
$list.each |$item| {
if $item == 'b' {
$letter = 'b'
notify{"Letter: ${letter}": }
}
}
notify{"Letter: ${letter}": }
View gist:1b92410703f356d04b73
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
EndSection
Section "Files"
EndSection
View gist:3e2fa636ecc83f52e5d1
# Installs Maven 3.1.1
node.override['maven']['3']['version'] = "3.1.1"
node.override['maven']['3']['checksum'] = "077ed466455991d5abb4748a1d022e2d2a54dc4d557c723ecbacdc857c61d51b"
include_recipe 'maven'
View dashing_zabbix_trigger.md

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
View gist:7267465
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]"
View gist:7091241
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) }
You can’t perform that action at this time.