Skip to content

Instantly share code, notes, and snippets.

View kylenstone's full-sized avatar

Kyle kylenstone

  • Save Your Generation
  • Boulder, Colorado
View GitHub Profile
@kylenstone
kylenstone / browserbash
Created August 17, 2013 12:26
Small bash script to configure Browserstack and open a new test window in a browser
#!bin/bash
# BrowserStack SSH Tunnel Setup
# Find key by logging into BrowserStack --> finding command line setup info
KEY=[YOUR_KEY_HERE]
# Add internal hosts here
INTERNAL_HOSTS=stgwebus
# Change argument to add +1 internal host: ${host}.[hostname].com,80,0,${host}.example.com,443,1
@kylenstone
kylenstone / .block
Last active March 2, 2020 02:44
Visualization for yoga gunas.
license: gpl-3.0
@kylenstone
kylenstone / .block
Created March 2, 2020 02:45 — forked from mbostock/.block
Force-Directed Symbols
license: gpl-3.0
@kylenstone
kylenstone / index.js
Created September 13, 2020 17:32 — forked from arv25/index.js
Lambda calling lambda with trace id
// Lambda 1 - arv-foo
// Synchronous fn that will back API Gateway endpoint.
const AWS = require('aws-sdk');
const lambda = new AWS.Lambda();
const getRandomInt = (max) => Math.floor(Math.random() * Math.floor(max));
exports.handler = async (event, context) => {
console.log("event:", event)
@kylenstone
kylenstone / custom_action_payload.json
Created September 19, 2020 00:40
Frame.io Custom Action Payload
{
"action_id": "44f40b4a-65e9-479a-b2bf-40ec57111c88",
"interaction_id": "667187cd-55b8-4eb7-8476-7a76564587d4",
"project": {
"id": "4c267d96-2fe6-4764-8d8a-a33849cd05d8"
},
"resource": {
"id": "3188b2f6-214d-480b-b8e2-0b985039b079",
"type": "asset"
},
@kylenstone
kylenstone / api.js
Created September 19, 2020 01:07
Frame.io Custom Action Backup to S3: API.js Helper Library
const AWS = require('aws-sdk');
const fetch = require('node-fetch');
async function fetchAsset (id) {
const token = process.env.FRAMEIO_TOKEN;
let url = `http://api.frame.io/v2/assets/${id}`;
let requestOptions = {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@kylenstone
kylenstone / firstLambda.js
Created September 19, 2020 01:12
Frame.io Custom Action Backup to S3 Code: Lambda #1
const { fetchAsset, invokeLambda } = require('./modules/api');
exports.handler = async function (event, context) {
// Save the X-ray Trace ID and and this Lambda's function name.
// We'll pass them to our second 'file handler' Lambda.
const firstLambdaTraceID = process.env._X_AMZN_TRACE_ID;
const caller = context.functionName;
let id = JSON.parse(event.body).resource.id;
let { url, name} = await fetchAsset(id);
@kylenstone
kylenstone / secondLambda.js
Created September 19, 2020 17:10
Frame.io Custom Action Backup to S3 Code: Lambda #2
const { s3Uploader } = require('./modules/api');
exports.handler = async (event) => {
let { caller, firstLambdaTraceID, url, name } = event;
// Logs for convenient searching in X-Ray and CloudWatch
console.log(`Second Lambda trace ID: ${process.env._X_AMZN_TRACE_ID}`);
console.log(`Called by ${caller} with trace ID: ${firstLambdaTraceID}. Begin uploading ${name}...`);
try {
@kylenstone
kylenstone / folder-templater-nodejs-example.js
Created September 22, 2020 17:56
Sample code to automatically create Frame.io Projects and Folders
// Note: this sample code is in the process of being re-written
// and assumes a client SDK is available to wrap API requests
// such as createFolder(). The intent is simply to provide
// convenience methods, but you can also write your own API requests
// as shown in this example: https://github.com/Frameio/custom-actions-example-app/blob/ks/DEVREL-589/examples/custom-action-offload-to-s3/modules/api.js
const apiClient = require('./api/client.js')
const template = require('./templates/onlineTemplate.json')
function createProject(name, teamId) {
@kylenstone
kylenstone / onlineTemplate-folderTemplateExample.json
Created September 22, 2020 17:57
Example JSON object containing a combined project and folder template
[
{
"name": "Grade",
"type": "project",
"folders": [
{
"name": "Online",
"type": "folder"
},
{