Skip to content

Instantly share code, notes, and snippets.

Error: object is null or undefined

Peter Banjo iampeterbanjo

Error: object is null or undefined
Block or report user

Report or block iampeterbanjo

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
iampeterbanjo / pull-data-processing.js
Created May 31, 2019
Pull data processing pipeline
View pull-data-processing.js
* Prototype of a data processing pipeline
* that uses strings as an example.
* the idea is to be fault tolerant by processing
* each word and so allow filtering of bad data
* instead of a batch processing approach
* which can cause the pipeline to halt on errors
* without any good data make it through to
* completion.
iampeterbanjo /
Created May 30, 2018
AWS change user password using CLI
# Step 1: Get a session token for the desired user:
aws cognito-idp admin-initiate-auth --user-pool-id %USER POOL ID% --client-id %APP CLIENT ID% --auth-flow ADMIN_NO_SRP_AUTH --auth-parameters USERNAME=%USERS USERNAME%,PASSWORD=%USERS CURRENT PASSWORD%
# Step 2: Issue the challenge response:
aws cognito-idp admin-respond-to-auth-challenge --user-pool-id %USER POOL ID% --client-id %CLIENT ID% --challenge-name NEW_PASSWORD_REQUIRED --challenge-responses NEW_PASSWORD=%DESIRED PASSWORD%,USERNAME=%USERS USERNAME% --session %SESSION KEY FROM PREVIOUS COMMAND with ""%
iampeterbanjo / package.json
Created Apr 13, 2018
Node API boilerplate
View package.json
"name": "node-api",
"version": "0.0.1",
"description": "Node API",
"keywords": ["Node.js", "API"],
"dependencies": {
"axios": "^0.16.2",
"cors": "^2.8.4",
"dotenv": "^4.0.0",
"express": "^4.15.3",
View setupTestEnvironment.js
// setup test environment for jest and jsdom to
// allow code like window.location.href = '/'
// # setupEnvironment.js
const JSDOMEnvironment = require('jest-environment-jsdom');
module.exports = class JSDOMEnvironmentGlobal extends JSDOMEnvironment {
constructor(config) {
# create new user, user directory and use bash shell
sudo useradd -m $1 -s /bin/bash
# add user to sudo group
usermod -a -G sudo $1
# use root ssh key for this user
mkdir -p /home/$1/.ssh
touch /home/$1/.ssh/authorized_keys
cat ~/.ssh/authorized_keys >> /home/$1/.ssh/authorized_keys
wget -nv -O - | sh
# setup dokku apt repository
wget -nv -O - | apt-key add -
export SOURCE=""
echo "deb $SOURCE trusty main" | tee /etc/apt/sources.list.d/dokku.list
apt-get update
# install dokku
apt-get install dokku
iampeterbanjo /
Created Jan 28, 2018
Fix zfs module not loading
sudo apt install zfs-dkms
sudo modprobe zfs
# replace with your version of zfs
dkms remove -m zfs -v --all
dkms remove -m spl -v --all
dkms add -m spl -v
dkms add -m zfs -v
dkms install -m spl -v
dkms install -m zfs -v
iampeterbanjo /
Last active Jan 28, 2018
Boostrap juju controller on localhost with LXD
sudo apt install lxd zfs zfsutils-linux
newgrp lxd
sudo lxd init
juju bootstrap localhost lxd-controller
# run with
# bash <(curl -s
apt-get update
apt-get install build-essential libssl-dev
apt-get install -y libssl-dev
apt-get install -y zfsutils-linux # will fail on dkms
# Determine versions
arch="$(uname -m)"
iampeterbanjo / package.lint.test.json
Last active Jan 19, 2018
package.json snippet with jest test runner, prettier formatter and eslint
View package.lint.test.json
"prettier": {
"arrowParens": "always",
"bracketSpacing": true,
"jsxBracketSameLine": true,
"printWidth": 90,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
You can’t perform that action at this time.