Skip to content

Instantly share code, notes, and snippets.

View npearce's full-sized avatar
🏠
Working from home is now totally redundant, right?

Nathan Pearce npearce

🏠
Working from home is now totally redundant, right?
View GitHub Profile
@npearce
npearce / Better_Error.js
Last active July 31, 2018 15:20
F5 iControl LX - How to access additional error response data (lines 25 & 26)
/**
* Apply the new, or modified, service definition to the BIG-IP
* @param {Object} service_def retireved from GitHub repo
*
* @returns {Object} AS3's declaration processing results
*/
MyWorker.prototype.applyServiceDefinition = function (service_def) {
return new Promise((resolve, reject) => {
@npearce
npearce / iControl_LX_Package_Operations.md
Last active August 24, 2018 21:46
F5 iControl LX workers: Install and Uninstall RPM's

About

The F5 iControl LX Framework enables engineers to create custom Nodejs control-plane actions/workflows for the F5 BIG-IP hardware and software appliances.

Put the RPM on the BIG-IP

Copy the RPM using scp (or some SCP capabe GUI tool).

SCP instructions

@npearce
npearce / BigStats_ApacheKafka_Setup.md
Last active September 5, 2018 03:28
BigStats Setup for: F5 BIG-IP -> Apache Kafka message bus

Create the Apache Kafka Container for BigStats on AWS

Updated: August 21, 2018

NOTE: This setup is used as an exporter destination for BigStats: https://npearce.github.io

Create the Instance

On the AWS Console:

  1. In 'Instances', click 'Luanch Instance'.
  2. Select 'Amazon Linux 2 AMI (HVM), SSD Volume Type'
@npearce
npearce / bash-filesystem_permissions.sh
Last active November 15, 2018 18:24
*nix filesystem permissions
// using `type -d` and `type -f` to isolate
// Change all directories to 775, and ignore files
find /home/user -type d -exec chmod 775 {} \;
// Change all files to 664, and ignore directories
find /home/user -type f -exec chmod 664 {} \;
@npearce
npearce / node-tgz-permissions.js
Last active November 15, 2018 18:38
Create gzipped tarballs in nodejs with correct owners & permissions.
//NOTE: the source permissions need to be set appropriately, also.
// npm i --save targz
const targz = require('targz')
targz.compress({
src: '/tmp/mydirectory',
dest: 'output/filename.tgz',
tar: {
dmode: 0775, // Directories: rwxrwxr-x
@npearce
npearce / Install-Openwhisk.md
Last active November 29, 2018 20:31
Install Openwhisk on Amazon AMI w/ docker-compose
@npearce
npearce / BigStats_GraphiteDB_Grafana_Setup.md
Last active February 8, 2019 20:20
BigStats Setup for: F5 BIG-IP -> StatsD -> GraphiteDB -> Graphana Dashboards

Create the Grafana Dashboard Container for BigStats on AWS

Updated: August 21, 2018

NOTE: This setup is used as an exporter destination for BigStats: https://npearce.github.io

Create the Instance

On the AWS Console:

  1. In 'Instances', click 'Luanch Instance'.
  2. Select 'Amazon Linux 2 AMI (HVM), SSD Volume Type'

Testing Gist naming....

@npearce
npearce / math.js
Created January 28, 2020 03:45
Javascript Floating Point Arithmetic
233.66 + 157.55
// returns: 391.21000000000004
// Because: https://stackoverflow.com/questions/588004/is-floating-point-math-broken/27030789#27030789
// As toFixed() converts to a string, use Math.round()
// 2 decimal places:
Math.round( (233.66 + 157.55)) * 1e2 ) / 1e2