Skip to content

Instantly share code, notes, and snippets.

View coreylight's full-sized avatar
🚚
Up and up

Corey Light coreylight

🚚
Up and up
View GitHub Profile

Keybase proof

I hereby claim:

  • I am coreylight on github.
  • I am coreylight (https://keybase.io/coreylight) on keybase.
  • I have a public key whose fingerprint is 0B14 3F54 F066 89EB F0DD BCA3 1581 5DAE 3C9B 9FD7

To claim this, I am signing this object:

curl 'https://api.opsee.com/graphql' -H 'Pragma: no-cache' -H 'Origin: https://app.opsee.com' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.8' -H 'authorization: $OPSEE_TOKEN' -H 'content-type: application/json' -H 'Accept: */*' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36' -H 'Cache-Control: no-cache' -H 'Referer: https://app.opsee.com/' -H 'Connection: keep-alive' --data-binary '{"query":"{\n checks {\n \tid\n notifications {\n value\n type\n }\n target {\n address\n name\n type\n id\n }\n name\n min_failing_time\n min_failing_count\n response_count\n state\n spec {\n ... on schemaHttpCheck {\n verb\n protocol\n
@coreylight
coreylight / sls-plugin-post-block-1.js
Created April 21, 2017 16:49
Serverless Plugin Post Block 1
const uuid = require('uuid');
exports.handler = (event, context, callback) => {
const response = {
statusCode: 200,
body: JSON.stringify({
message: 'Your uuid is: ' + uuid.v4(),
input: event
})
};
callback(null, response);
@coreylight
coreylight / sls-plugin-post-block-3.js
Created April 21, 2017 16:53
Serverless Plugin Post Block 3
const shift = require('jscodeshift');
const code = 'The string literal of the code to transform (from above)';
const searchObject = {
left: {
type: 'MemberExpression',
object: {
type: 'Identifier',
name: 'exports'
},
property: {
@coreylight
coreylight / sls-plugin-post-block-4.js
Created April 21, 2017 16:54
Serverless Plugin Post Block 4
exports.handler = //anything here
@coreylight
coreylight / sls-plugin-post-block-5.js
Created April 21, 2017 16:55
Serverless Plugin Post Block 5
exports
.handler = // 😎 this will work too
@coreylight
coreylight / sls-plugin-post-block-2.js
Last active May 5, 2017 14:16
Serverless Plugin Block 2
const uuid = require('uuid');
const iopipe = require('iopipe')({token: 'TOKEN'});
exports.handler = iopipe((event, context, callback) => {
const response = {
statusCode: 200,
body: JSON.stringify({
message: 'Your uuid is: ' + uuid.v4(),
input: event
})
};
@coreylight
coreylight / sls-plugin-post-block-6.js
Last active May 5, 2017 14:16
Serverless Plugin Post Block 6
const wrapper = "require('iopipe')({token: 'TOKEN'})(REPLACE)";
shift(wrapper)
.find(shift.Identifier, {
name: 'REPLACE'
})
.replaceWith(found);
const iopipeLib = require('iopipe');
const tracePlugin = require('iopipe-plugin-trace');
const iopipe = iopipeLib({
plugins: [tracePlugin()]
});
// wrap your lambda handler
exports.handler = iopipe((event, context) => {
const mark = context.iopipe.mark;
const startTime = process.hrtime();
await runTheDatabaseCall();
const endTime = process.hrtime(startTime);
console.log(endTime);
// [ 8, 210181641 ]