Skip to content

Instantly share code, notes, and snippets.

View j5bot's full-sized avatar

Jonathan Cook j5bot

View GitHub Profile
const NodeRSA = require('node-rsa');
export const generateWalmartHeaders = (consumerId, timestamp, publicKeyVersion, privateKey) => {
// the order here is important ... they are sorted according to the header names
const stringToSignComponents = [
consumerId,
timestamp,
publicKeyVersion
];
// join the components into one string, and add the trailing newline
openssl rsa -in WM_IO_private_key.pem -out > WM_IO_private_key
# Generate key pair 2048 bit
openssl genrsa -des3 -out WM_IO_my_rsa_key_pair 2048
# Export private key WM_IO_private_key.pem
openssl pkcs8 -topk8 -inform PEM -in WM_IO_my_rsa_key_pair -outform PEM -out WM_IO_private_key.pem -nocrypt
#### THIS IS NEW ####
# Export private key WM_IO_private_key
openssl rsa -in WM_IO_private_key.pem -out > WM_IO_private_key
#### THIS IS NEW ####
{
"numFailedTestSuites": 0,
"numFailedTests": 0,
"numPassedTestSuites": 10,
"numPassedTests": 467,
"numPendingTestSuites": 0,
"numPendingTests": 0,
"numRuntimeErrorTestSuites": 0,
"numTotalTestSuites": 10,
"numTotalTests": 467,
import React from 'react'; // needed for JSX
export const AnyTag = (props) => {
// Create a Capitalized reference to a String
// whatever is in the string will be the tagname of our "Component"
const TagName = props.tagName;
// make a copy of props that we can mutate
let propsCopy = { ...props };
import React from 'react'; // required in order to use JSX
import Type1 from './Type1'; // load one type of component
import Type2 from './Type2'; // load a second type of component
// a component that will render one or more components
// based on a switch statement
export const SwitchedComponent = (props) => {
let Output; // save the rendered JSX to return
import React from 'react'; // required to use JSX
export const CapitalizedReferenceComponentCollectionExternals = (props) => {
// get references to all possible components
// that this component might render,
// and the collection of dynamic components we need to render,
// using destructuring
const { components: Components, collection } = props;
import React from 'react'; // required to use JSX
export const CapitalizedReferenceComponentExternals = (props) => {
// get references to all possible components
// that this component might render
const { type, components: Components } = props;
// make a Capitalized reference to a specific component
// which we'll render
import React from 'react'; // required in order to use JSX
import Type1 from './Type1'; // load one type of component
import Type2 from './Type2'; // load a second type of component
// make references to the components by type
const Components = {
Type1,
Type2
};
@j5bot
j5bot / sleepAt.5m.sh
Last active June 24, 2017 00:15
BitBar plugin with the aim of putting a MacBook to sleep when the battery reaches a certain percentage level
#!/bin/sh
######################### USAGE #########################
# rename the plugin/script to include parameters for the
# minimum uptime before trying to enforce sleeping below
# the battery level and the battery level to sleep below
# use the format -<NUMBER>up-<NUMBER>perc
#
# example: sleepAt-10up-10perc.5m.sh
#