Skip to content

Instantly share code, notes, and snippets.

View benagricola's full-sized avatar
🐒
Working on MillenniumOS!

Ben Agricola benagricola

🐒
Working on MillenniumOS!
View GitHub Profile
@benagricola
benagricola / common-common.yaml
Last active December 16, 2015 17:59
%{calling_module} in 3.2.0-rc1 doesn't work for automatic lookups?
---
test::test1: common.yaml
test::test2: common.yaml
@benagricola
benagricola / hiera.yaml
Created May 1, 2013 12:04
Profiles and Roles with Hiera / Puppet 3
---
:backends:
- yaml
- gpg
:gpg:
:datadir: '/etc/puppet/hiera'
:yaml:
:datadir: '/etc/puppet/hiera'
@benagricola
benagricola / update.sh
Created February 26, 2015 19:15
Convert PuppetDB output to Rundeck JSON format
#!/bin/bash
APIENDPOINT=${1:-"https://puppetdb:8081/v4"}
APICERT=${2:-"/etc/pki/tls/certs/localhost.crt"}
APIKEY=${3:-"/etc/pki/tls/private/localhost.key"}
APICA=${4:-"/etc/pki/tls/certs/ca.pem"}
RESOURCEFILE=${5}
CURLCMD="curl -s -X GET --cacert $APICA --key $APIKEY --cert $APICERT $APIENDPOINT"
JSON=$($CURLCMD/facts/ | jq -r -s '(reduce .[][] as $item({} ; .[$item.certname].attributes = .[$item.certname].attributes + {($item.name): $item.value} | .[$item.certname].attributes.hostname = .[$item.certname].attributes.fqdn | .[$item.certname].attributes.username = "root")) | {nodes: .}')
if [ -z "$RESOURCEFILE" ]; then
local num = 144678151251494874
local bin = ""
while num > 0 do
local char = num % 256
num = num - char
num = num / 256
bin = string.char(char) .. bin
end
print(pickle.unpack('bbNn',bin))
@benagricola
benagricola / comm.lua
Created May 21, 2015 21:49
BGP extended community number decoding - Python vs. Lua
#!/usr/bin/env tarantool
local pickle = require('pickle')
local denumerate = function(num)
local bin = ''
while num > 0 do
local char = num % 256
num = num - char
num = num / 256
bin = string.char(char) .. bin

Keybase proof

I hereby claim:

  • I am benagricola on github.
  • I am benagricola (https://keybase.io/benagricola) on keybase.
  • I have a public key ASDAOij939_OvDosgdcagrYc05hIcl90KgzflKn7aGj7Gwo

To claim this, I am signing this object:

@benagricola
benagricola / hook-cot.py
Created June 22, 2017 16:51
One-File, redistributable Scrapy based Crawler, using pyinstaller. Generate binary using pyinstaller scrape.spec
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
# This hooks the scrapy project 'cot' to import all submodules, change name to match scrapy project
hiddenimports = (collect_submodules('cot'))
@benagricola
benagricola / 0_get_bgp.yml
Last active July 3, 2017 15:39
junos_command module does not return parsed XML object
- name: Get BGP Neighbor Info
hosts: all
gather_facts: False
connection: local
tasks:
- name: Get BGP Peers
junos_command:
rpcs:
- "get-bgp-summary-information"
display: xml
<?php
/**
* Class X_Io_File
*/
class X_Io_File extends Varien_Io_File {
/**
* @return void
*/
@benagricola
benagricola / s3ql_install-centos7.sh
Last active March 20, 2019 13:15 — forked from scottames/s3ql_install-centos7.sh
s3ql - centos 7 install
#!/usr/bin/env bash
#
## Install s3ql on centos 7 machine
### https://bitbucket.org/nikratio/s3ql/
# yum packages
sudo yum install -y epel-release
sudo yum install -y \
bzip2 \
git \
fuse \