Skip to content

Instantly share code, notes, and snippets.

View joshbalfour's full-sized avatar

Josh Balfour joshbalfour

View GitHub Profile
@joshbalfour
joshbalfour / get-stack-outputs.ts
Created September 25, 2023 14:18
get cloudformation stack outputs
import { CloudFormationClient, DescribeStacksCommand } from '@aws-sdk/client-cloudformation'
let cachedOutputs: any | undefined
export const getStackOutputs = async () => {
if (cachedOutputs) {
return cachedOutputs
}
const cfnClient = new CloudFormationClient({
region: process.env.STACK_REGION,
})
@joshbalfour
joshbalfour / rds-global-database-cluster.ts
Last active February 7, 2024 16:47
RDS Global Database Cluster CDK example
import { DatabaseCluster, CfnGlobalCluster, DatabaseClusterProps, CfnDBCluster } from 'aws-cdk-lib/aws-rds'
import { Construct } from 'constructs'
export class GlobalDatabaseCluster extends DatabaseCluster {
public readonly globalCluster: CfnGlobalCluster
constructor(scope: Construct, id: string, props: DatabaseClusterProps) {
super(scope, id, props)
this.globalCluster = new CfnGlobalCluster(this, 'global-cluster', {
@joshbalfour
joshbalfour / atlassian-connect.json
Last active February 25, 2022 16:00
How to use the Bitbucket API to generate an access token as an app or "add-on" using JWT auth, and download a repo
{
"key": "random-key",
"name": "Example App",
"description": "An example app for Bitbucket",
"vendor": {
"name": "Angry Nerds",
"url": "https://www.atlassian.com/angrynerds"
},
"baseUrl": "populated-at-runtime",
"authentication": {
@joshbalfour
joshbalfour / extract.js
Created June 23, 2019 15:43
RiKroll - extract assets protected using Kroll's AssetCrypt
const fs = require('fs')
const path = require('path')
const fse = require('fs-extra')
const code = fs.readFileSync('app.code.json', 'utf-8')
const obj = JSON.parse(code)
Object.entries(obj).forEach(([loc, contents]) => {
const absPath = path.resolve('.', 'output', loc)
@joshbalfour
joshbalfour / AudioPlayer.js
Last active April 2, 2019 04:40
react native streaming audio player
import React from 'react'
import PropTypes from 'prop-types'
import ReactNative from 'react-native'
const audio = ReactNative.NativeModules.RNStreamingAudioPlayer
const audioEvent = new ReactNative.NativeEventEmitter(ReactNative.NativeModules.RNStreamingAudioPlayer)
import {
View,
@joshbalfour
joshbalfour / graphql-server-koa-one.js
Created February 18, 2017 18:49
Koa 1.x wrapper for graphql-server-koa
const { graphqlKoa, graphiqlKoa } = require('graphql-server-koa')
module.exports = {
graphqlKoa: options => function *(){
const context = this
return yield graphqlKoa(Object.assign({}, options, {
context
}))(context)
},
graphiqlKoa: options => function (){
//load site
[wview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://192.168.105.137:19000/workspace/index.jsp"]]];