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
#Market drops ~20% and then gains ~10%, then drops another ~25% and then gains ~14%,
#market drops ~20% and then gains ~16%. Then the final leg down. Market drops ~30% in capitulation
starting_capital = 3386
capital = starting_capital
print('starting at %s' % capital)
# -20%
capital = capital - capital * .2
andrewfraley /
Created Mar 12, 2019
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
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"
Section "Files"
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'

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 {} \;
not_if { ::File.exists?(extract_path) }
You can’t perform that action at this time.